Create a share directory that requires user authentication.
sudo groupadd security mkdir /home/security chgrp security /home/security chmod 770 /home/security sudo vi /etc/samba/smb.conf
Edit the Samba config file:
# line 25: add unix charset = UTF-8 # line 30: change (Windows' default) workgroup = WORKGROUP # line 51: uncomment and change IP address you allow interfaces = 127.0.0.0/8 10.0.0.0/24 # line 58: uncomment bind interfaces only = yes # add to the end any share name you like [Security] path = /home/security writable = yes create mode = 0770 directory mode = 0770 # guest not allowed guest ok = no # allow users only in [security] group valid users = @security
Add user in Samba
smbpasswd -a peter
will prompt for a password:
New SMB password: # set password
Retype new SMB password:
Added user ubuntu.
Add the user to the security group:
sudo usermod -G security peter
Restart Samba
sudo systemctl restart smbd