[PIGET] Access files (samba)

[PIGET] Access files (samba)

We will learn how to access files on our Raspberry Pi using Samba.

schéma_Samba

Prerequisite : Piget

Thanks to Samba, we can use Windows file sharing on Linux.

Windows network shares are compatible with all operating systems.

In this tutorial, We are going to

  • Install samba module
  • Share piget’s folder
  • Protect all shared folder with a password
  • Learn how to fix issues on Windows
  • See what’s inside piget’s folders
  • Create a report
  • Share all files on a Raspberry pi
  • See all the other commands
Installation

To install a module on Piget, we just need to type this on our terminal:

/pi/install nom_du_module

  • Install samba module

/pi/install samba

Samba is installed (if it wasn’t already), then a default password is created. No files are shared.

User : pi
Password : raspberry

 

Share Piget folders

To share piget’s folders, type

/do/samba/sharePiget

This will set up and restart samba

Protect your network shares with a password

Before we go to the files on our Raspberry Pi, we should change the default password.

Tape this to change password and type your password twice.

/do/samba/setupPassword

You can access shared folders in Network on Windows explorer

reseau

Fix issues on Windows

If you have previously entered a different password, this may have been cached by Windows, we can’t change it and an error message will be displayed.

error

There are 3 ways to fix this:

  • close and open your session
  • restart your computer
  • Type these commands on the command line as an Administrator (Shortcut : WINDOWS-X then A)

net stop workstation
net start workstation

We are going to see what we have shared.

schéma_Samba

Boot folder

Click on your Raspberry Pi in Network and enter pi as your username and password

password

In boot folder, we can store files that will be available on the boot partition on our Raspberry Pi.
This partition is the only one that can be access on Windows, when you plug your sd card on your computer.

This partition only have 37 megas, so you shouldn’t store anything except text files.

We are going to use this partition to create a text file which will explain what is installed on your Raspberry Pi.

Create a report

To generate a report, type :

/pi/logBook

This will create logBook.txt on your SD card.

This file contain a list of installed modules, the name of our Raspberry Pi, the IP address of our Raspberry Pi.

Here is an example of a log :

Logbook.txt
Piget folder

The folder Piget contains all piget’s scripts and softwares.
You can see and modify how Piget works here.

However if you update your Raspberry Pi by typing :

/pi/update

All modifications will be lost, except if you create a new module, will see how on another tutorial.

User folder

Finally, you can store all your personal files in the user folder.

  • You can save your own scripts in /user/scripts
  • No setting is saved inside piget folder , there are saved inside /user/config
Share all folders

We will see how to share all folders on the Raspberry Pi.

Your Raspberry Pi will be completely vulnerable, only do this on your own network and if you really need it.

Type :

/do/samba/shareAll

We have now access to all folders.

Stop sharing
If you want to stop sharing files , type:

/do/samba/shareNothing

Once you don’t need it anymore, stop sharing files to avoid unwanted access to your Raspberry Pi.

Other shares

There are more settings available on samba modules

To code a website, you can share /var/www , by typing :

/do/samba/shareWeb

You can share the user folder only, by typing :

/do/samba/shareUser

Other commands
Modify samba settings

Load a previously saved settings
Save current settings
Add samba share
Remove a samba share
Copy a settings file (/etc/samba/smb.conf)
Download a settings file on github
Check if a folder is shared (0:no 1:yes)
Display a list of users
Change password directly
Change password (user need to type password)
Don't start samba at boot
Start samba at boot

Restart samba

Stop samba

Start samba

Display samba status (open files, users)

Display if a user is connected (0:no 1:yes)

There is a automatically generated documentation available at http://github.com/pigetnet/samba

If a module doesn’t have any documentation on Github, you should consider it as unfinished.

2 thoughts on “[PIGET] Access files (samba)

Comments are closed.

Comments are closed.