sambasharetoprivate
- Create Samba Group and Samba Users
sudo groupadd smbusers # Create system users (optional - or use existing ones) sudo useradd -G smbusers john sudo useradd -G smbusers jane # Set Samba passwords (different from system passwords) sudo smbpasswd -a john sudo smbpasswd -a jane
- Create folder in linux
sudo mkdir /private
- Set ownership and permissions
sudo chown root:smbusers /private sudo chmod 1770 /private # Sticky bit + group access
- Edit Samba config /etc/samba/smb.conf
[private] comment = Private Secure Share path = /private browseable = yes read only = no guest ok = no valid users = @smbusers create mask = 0660 directory mask = 0770 force group = smbusers # Security settings to prevent users from deleting each other's files # veto files are files that user can upload but then will be hidden from view. #veto files = /*.exe/*.com/*.bat/*.cmd/ # can also delete these veto files #delete veto files = yes
- Restart Samba by doing:
sudo systemctl restart smbd nmbd # Or for newer versions: sudo systemctl restart smbd winbind
To add Samba User: sudo useradd -G smbusers newuser sudo smbpasswd -a newuser
To delete Samba User: sudo smbpasswd -x username # Disable Samba access sudo deluser username # Remove system account (optional)
To access from Windows: \\your-server-ip\private
To access from Linux: smbclient server-ip/private -U username
sambasharetoprivate.txt · Last modified: by jwan
