-
Book Overview & Buying
-
Table Of Contents
Ubuntu Server Cookbook
By :
In the previous recipe, we installed the Samba server and created a public share accessible to everyone. In this recipe, we will learn how to add authentication to the Samba server and password protect shared directories.
You will need access to a root account or an account with sudo privileges.
Make sure that the Samba server is installed and running.
Follow these steps to add users to the Samba server:
Create a new user account. You can use any existing account or add a new Samba only account with the following command. Change smbuser to your desired username:
$ sudo useradd -d /home/smbuser -s /sbin/nologin smbuser
Now, we need to allocate a Samba password to this new user. First, enter your sudo password, followed by the new password for your Samba account, and then verify the password:
$ sudo smbpasswd -a smbuser

Create a shared directory for this user and change its ownership:
$ sudo chown smbuser:smbuser /var/samba/share/smbuser...