SAMBA
Preparation
- Create group for backups
sudo groupadd backupusers
- create new group
backupusers
- Create user for samba
sudo adduser --disabled-login --no-create-home --gecos "" smbbackup sudo usermod -aG backupusers smbbackup
- --disabled-login - no system login
- --no-create-home - no user home directory
- --gecos "" - no interactive questions for name and so on
- with
usermod: add user$USERto groupbackupusers
- Prepare directory to use with samba
sudo chown root:smbbackup /srv/ssd/backups sudo chmod 2770 /srv/ssd/backups
- Install samba
sudo apt install samba samba-common-bin smbclient cifs-utils systemctl status smbd --no-pager
- last one for checking status of smbd (active?)
- Registrate user for samba
sudo smbpasswd -a smbbackup sudo smbpasswd -e smbbackup
- first one registrates smbbackup with a chosen password as user in samba
- second one enables user smbbackup
- Change samba configuration
sudo cp /etc/samba/smb.conf "/etc/samba/smb.conf.backup-$(date +%F-%H%M%S)" sudo nano /etc/samba/smb.conf
add at the end
[Backups]
comment = Backups auf der externen SSD
path = /srv/ssd/Backups
browseable = yes
read only = no
guest ok = no
valid users = smbbackup
force group = backupusers
create mask = 0660
force create mode = 0660
directory mask = 2770
force directory mode = 2770
- Restart samba
sudo testparm -s sudo systemctl restart smbd
- check configuration and then restart
- Checks
1 2 3 | sudo systemctl status smbd --no-pager smbclient -L localhost -U smbbackup smbclient //localhost/Backups -U smbbackup |
1: check service active and enabled
2: check Shares of samba
3: connect to shell of samba and test mkdir test
- Prepare connection to network
1 2 3 4 | sudo ufw app list sudo ufw app info Samba sudo ufw allow in on <eth0> from <192.168.2.0/24> to any app Samba sudo ufw status |
1: all apps ufw knows 2: ufw info about Samba app (ports) 3: open ports for LAN in network to Samba 4: show changed ufw rules
