Installation
vmls4:
sudo apt update
sudo apt -y install samba samba-common cifs-utils
Konfiguration
Backup von Originalkonfiguration
vmls4:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
Share Ordner erstellen
vmls4:
sudo mkdir /home/vmadmin/testshare
sudo mkdir /var/smbshr
sudo mkdir /var/smbshr/tuxplanet
sudo mkdir /var/smbshr/ladiesplace
sudo mkdir /var/smbshr/mensplace
sudo mkdir /var/smbshr/scratch
sudo mkdir /var/smbshr/music
sudo chmod 2770 /var/smbshr/*
sudo chmod 2755 /var/smbshr/music
Samba Benutzer und Gruppen
vmls4:
sudo groupadd tuxies
sudo groupadd tuxladies
sudo groupadd tuxmens
sudo groupadd violenttux
sudo chown root:tuxies /var/smbshr/tuxplanet
sudo chown root:tuxladies /var/smbshr/ladiesplace
sudo chown root:tuxmens /var/smbshr/mensplace
sudo chown root:violenttux /var/smbshr/scratch
sudo chown root:tuxies /var/smbshr/music
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 laratux
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 cutetux
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 mrtux
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 rambotux
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 luketux
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 slashtux
sudo useradd -g tuxies -M -s /sbin/nologin -p sml12345 divatux
sudo usermod -aG tuxladies,violenttux laratux
sudo usermod -aG tuxladies cutetux
sudo usermod -aG tuxmens,violenttux mrtux
sudo usermod -aG tuxmens,violenttux rambotux
sudo usermod -aG tuxmens,violenttux luketux
sudo usermod -aG tuxmens slashtux
sudo usermod -aG tuxladies divatux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a vmadmin
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a laratux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a cutetux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a mrtux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a rambotux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a luketux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a slashtux
echo -ne "sml12345\nsml12345\n" | sudo smbpasswd -a divatux
Samba Konfiguration
vmls4: /etc/samba/smb.conf:
[global]
min protocol = SMB2
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
server role = standalone server
obey pam restrictions = no
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
[testshare]
path = /home/vmadmin/testshare
writable = yes
guest ok = no
valid users = vmadmin
force create mode = 770
force directory mode = 2770
inherit permissions = yes
[tuxplanet]
path = /var/smbshr/tuxplanet
writable = yes
guest ok = no
valid users = @tuxies
force create mode = 770
force directory mode = 2770
inherit permissions = yes
[ladiesplace]
path = /var/smbshr/ladiesplace
writable = yes
guest ok = no
valid users = @tuxladies
force create mode = 770
force directory mode = 2770
inherit permissions = yes
[mensplace]
path = /var/smbshr/mensplace
writable = yes
guest ok = no
valid users = @tuxmens
force create mode = 770
force directory mode = 2770
inherit permissions = yes
[scratch]
path = /var/smbshr/scratch
writable = yes
guest ok = no
valid users = @violenttux
force create mode = 770
force directory mode = 2770
inherit permissions = yes
[music]
path = /var/smbshr/music
writable = yes
guest ok = no
valid users = @tuxies
force create mode = 755
force directory mode = 2755
inherit permissions = yes
Neustart der Dienste
vmls4:
sudo systemctl restart smbd
sudo systemctl restart nmbd