Samba File Server & Client

Samba Package Installation

Install the Samba package:
apt-get install samba samba-common-bin smbclient

Create a backup copy of the original config file
WARNING: do this only the very first time!!
cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

Enable and start the Samba server:
/etc/init.d/samba enable
/etc/init.d/samba start

Server Configuration

Install support for the NTFS filesystem (if needed e.g. for sharing an external NTFS-formatted USB drive)
apt-get install ntfs-3g

Create a „Music“ folder to be shared
sudo mkdir /media/Music
sudo mount -t auto /dev/sda1 /media/Music

Create a „Video“ folder to be shared
sudo mkdir /media/Videos
sudo mount -t auto /dev/sda2 /media/Videos

Edit the filesystem table to auto mount the shares
nano /etc/fstab

Add the following lines

/dev/sda1 /media/Music auto noatime 0 0
/dev/sda2 /media/Videos auto noatime 0 0

Edit the Samba config file
nano /etc/samba/smb.conf

# set the name of your network workgroup
workgroup = WORKGROUP

# set the NetBios name of your machine
netbios name = myRaspiName
# uncomment the 'security = user' line. This is found in the #Authentication# section.
security = user

[Shares]
 comment = Shares Folder
 path = /media/Music
 valid users = @users
 force group = users
 create mask = 0660
 directory mask = 0771
 read only = no

Setup a Samba password for a Samba user
smbpasswd -a <NewUserName>
( e.g. smbpasswd -a pi)

Restart Samba server to reload the new settings
/etc/init.d/samba restart

Check Samba server status
/etc/init.d/samba status

Samba logfile: see the following line in /etc/samba/smb.conf

log file = /var/log/samba/samba.log

Client Configuration

Create a mount point for the share:
mkdir /mnt/mountpoint

Mount a shared folder of your (Windows) network:
mount -t cifs //servername/sharename /mnt/mountpoint -o user=username,password=password

Links

Schreibe einen Kommentar