Saturday 9 September 2017

Samba configuration (FreeBSD server, Manjaro Linux client)

Server

[global]
 netbios name = CHAOS
 workgroup = WORKGROUP
 security = user
 encrypt passwords = true
 map to guest = bad user
 guest account = nobody
 wins support = yes
[homes] 
 browsable = no
 writable = yes
 valid users = %S
[www]
 path = /home/www
 browsable = yes
 writable = no
 guest ok = yes
 guest only = yes

Be sure to give a blank password to the nobody user in the Samba database.

smbpasswd -a nobody

Client

The name resolve order is essential for Thunar to function properly.

[global]
 netbios name = ETHER
 workgroup = WORKGROUP
 name resolve order = bcast wins lmhosts hosts

Friday 8 September 2017

rsync (on FreeBSD, through cron) one-line incremental backup

Names have been changed to protect the innocent.
Creates a daily incremental backup archive of a remote site, hardlinked to save space. Logs changes.
Full paths are important due to cron environment!
Lines broken for web formatting...
/usr/local/bin/rsync -aizRH --stats -e "ssh -i /home/user/.ssh/id_rsa" --delete
 --link-dest=/home/user/backup/remotesite/`date -v-1d "+%Y-%m-%d"`
 root@www.remotesite.com:/etc :/var/www :/var/backups /home/user/backup/remotesite/`date +%Y-%m-%d`
 | /usr/bin/grep -E '^[^.]|^$' > /home/user/backup/remotesite/`date +%Y-%m-%d`.log
To clear old increments and save space:
/usr/bin/find /home/user/backup/remotesite -depth 1 -mtime +30d -exec rm -rf {} \;