Adding users to the Samba server

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.

Getting ready

You will need access to a root account or an account with sudo privileges.

Make sure that the Samba server is installed and running.

How to do it…

Follow these steps to add users to the Samba server:

  1. 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
    
  2. Now, we need to allocate a Samba password to this new user. First, enter ...

Get Ubuntu Server Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.