Samba

Samba allows to access data via a Windows drive. There are two ways: the shared drive can be on the Raspberry or on the Windows machine.

First samba needs to be added to the Raspberry https://www.raspberrypi.com/documentation/computers/remote-access.html#samba-smbcifs:

sudo apt install samba samba-common-bin smbclient cifs-utils

The configuration is in /etc/samba/smb.conf and can/should be verified with testparm

testparm -v -s returns all the global parameters without prompt for the dump

The Raspberry might run as server 24h a day whereas the window laptop might be turned on occasionally. So the Raspberry should host the shared network drive.

To let the Windows PC know what they will see modify /etc/samba/smb.conf to have something as:

workgroup = <RASPISERVERWORKGROUP>

sudo smbpasswd -a <username> is used to give a samba password for a user. Without samba passwords access user home directories fail.

smbclient -L localhost -U% executed on the Raspberry will test the samba server without asking for a password. smbclient -L localhost will do the same but as user and asking for the samba password.

Finally there is also sudo smbstatus

Access the samba server from an other linux client

It is more native to use NFS for Linux systems, but using samba might be a good test before trying to connect Windows to Linux.

If the two usernames (=sharenames) are the same, the users home directory on the samba server can be accessed by the client as: smbclient //192.168.1.<x>/<username>

A prompt appears were help list the commands, cd, ls lets browsing in the share names directory

Access the samba server from a Windows client

Adding a share is straight forward, just adding ip address and sharename \\192.168.1.<x>\<username> as network drive or network address.


Linurs startpage