SAMBA (install and configure)

Install and configure Samba

sudo apt-get install samba -y

Once the software is installed, you’re ready to configure your first share. Open the samba configuration file:

Your Samba shares will be configured in /etc/samba/smb.conf, so open that file with the command:

sudo nano /etc/samba/smb.conf

Scroll to the bottom and add the following for each share:

[ShareName]

path = /var/www/www.website.com

valid users = paul

browsable = yes

writable = yes

read only = no
  • [ShareName] is the visible name of the share when connecting to the server
  • valid users: the list of users that are allowed to access this share. The user needs to be added to Samba and a password needs to be generated.
  • path: the absolute path on the disk
  • browsable: make the share visible or invisible on the network
  • writable: make the share writable (or not)
  • read-only: make the share read-only (or not)

Save (CTRL-O) and close (CTRL-X) the configuration file.
Restart the Samba daemon:

sudo systemctl restart smbd

Add a user to Samba

After limiting access to a list of users (see above), you have to add the user to Samba and create a password for him/her.

sudo smbpasswd -a paul

You will be prompted to enter the password and confirm it for user paul. After creating the user, you have to enable him/her.

Enable a user

sudo smbpasswd -e paul

Disable a user

sudo smbpasswd -d paul

Delete a user

sudo smbpasswd -x paul

Leave a Reply