π $ samba - Samba Setup in Debian 12
This guide explains step by step how to set up a Samba server on Debian 12, using the directory /rack with three subdirectories: shared, martin, and marian. The setup will allow:
- π shared folder - full access for everyone
- π martin folder - full access only for
martin, others get read-only - π marian folder - full access only for
marian, others get read-only
1οΈβ£ Install Samba
sudo apt update
sudo apt install samba samba-common-bin
2οΈβ£ Create folder structure
sudo mkdir -p /rack/shared
sudo mkdir -p /rack/martin
sudo mkdir -p /rack/marian
3οΈβ£ Create users and passwords
sudo adduser martin
sudo smbpasswd -a martin
sudo adduser marian
sudo smbpasswd -a marian
4οΈβ£ Set folder permissions (Linux)
sudo chown -R nobody:nogroup /rack/shared
sudo chmod -R 0777 /rack/shared
sudo chown -R martin:martin /rack/martin
sudo chmod -R 0755 /rack/martin
sudo chown -R marian:marian /rack/marian
sudo chmod -R 0755 /rack/marian
5οΈβ£ Edit /etc/samba/smb.conf
In Samba, you can set valid users and who has read only, write only, or write list access. See the example below:
[shared]
path = /rack/shared
browseable = yes
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777
[martin]
path = /rack/martin
valid users = martin @users
read only = yes
write list = martin
create mask = 0755
directory mask = 0755
[marian]
path = /rack/marian
valid users = marian @users
read only = yes
write list = marian
create mask = 0755
directory mask = 0755
π‘ Explanation of parameters:
valid users- who can access the shareread only- default read-only for everyonewrite list- users allowed to writecreate mask- permissions for new filesdirectory mask- permissions for new directories
6οΈβ£ Restart Samba service
sudo systemctl restart smbd.service
7οΈβ£ Access from Windows
\\your-server-ip\shared
\\your-server-ip\martin
\\your-server-ip\marian
"A stable shared structure is the foundation of every digital workshop. Samba is the bridge between machines - and between people."
root - Toni Angelchovski