Granting authenticated access
Samba supports granting authenticated access to shares in addition to making them available as public shares.
How to do it…
Select the account that you want to use for authentication. All Samba share accounts must be accompanied by a Unix account. In this case, we'll user a new user called
testuser
:sudo useradd testuser
Create a separate Samba-specific password for that account:
sudo smbpasswd –a testuser
Modify
smb.conf
to set the valid users for the share:[myshare] path = /home/share guest ok = yes read only = yes valid users = testuser
Access the share once again; confirming that this time, you are prompted for a username and password.
How it works…
As mentioned in the preceding, Samba users must be backed by a system user account that is known to PAM. This could mean a user in /etc/passwd
, or it could mean a user account coming from some sort of directory service. In this case, we are going to create a dedicated user account.
Authentication however is...