Granting authenticated access

Samba supports granting authenticated access to shares in addition to making them available as public shares.

How to do it…

  1. 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
    
  2. Create a separate Samba-specific password for that account:
    sudo smbpasswd –a testuser
    
  3. Modify smb.conf to set the valid users for the share:
    [myshare]
      path = /home/share
      guest ok = yes
      read only = yes
       valid users = testuser
  4. 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 ...

Get Linux Networking 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.