Automated Backups Using dhcpd On Ubuntu
Automated Backups Using dhcpd On UbuntuThis tutorial shows how to set up automated backups of Linux hosts through dhcp using Ubuntu. I will use following software:
1 On The Server1.1 Configure dhcp3In /etc/dhcp3/dhcps.conf add: on commit {
execute (
"/etc/dhcp3/startbackup.sh",
"start",
binary-to-ascii(10,8,".",leased-address)
);
}
1.2 Create startbackup.shsudo vi /etc/dhcp3/startbackup.sh #!/bin/bash case "$1" in start) sudo -u backup /etc/dhcp3/rsync.sh $2 ;; *) ;; esac exit 0
1.3 Create rsync.shsudo vi /etc/dhcp3/rsync.sh #!/bin/bash nohup rsync -azuvb backup@$1:/home /backup/$1 & and add the /backup folder: sudo mkdir /backup
1.4 Add The User backupsudo useradd backup sudo chown backup:backup /backup Create the private/public ssh keys: ssh-keygen -t rsa Copy the public key to all hosts you want to back up: ssh-copy-id -i ~/.ssh/id_rsa backup@[host] Replace [host] with your hostname(s) or ip address(es).
1.5 Configure sudosudo visudo and add a line like this: dhcpd ALL=(backup)NOPASSWD: /etc/dhcp3/startbackup.sh, /etc/dhcp3/rsync.sh
1.6 Configure AppArmorsudo vi /etc/apparmor.d/usr.sbin.dhcpd3 Change the part that looks like: /etc/dhcp3/ r, /etc/dhcp3/** r, /etc/dhcpd.conf r, /etc/dhcpd_ldap.conf r, to: /etc/dhcp3/ r, /etc/dhcp3/** r, /etc/dhcp3/startbackup.sh Uxr, /etc/dhcpd.conf r, /etc/dhcpd_ldap.conf r,
1.7 Restart Servicessudo /etc/init.d/apparmor restart sudo /etc/init.d/dhcp3-server restart
On The Client2.1 Add The User backupsudo useradd backup sudo usermod -G root
2.2 Test The Setupsudo dhclient [interface] where interface is the one you want to renew You should now have a backup of your clients on the server.
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning



![Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License [Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License]](http://creativecommons.org/images/public/somerights20.gif)




Recent comments
15 hours 10 min ago
17 hours 11 min ago
20 hours 22 min ago
22 hours 42 min ago
23 hours 52 min ago
1 day 1 hour ago
1 day 5 hours ago
1 day 8 hours ago
1 day 8 hours ago
1 day 23 hours ago