I wanted to setup a script which I can fire off via cron job or with shell script which will sync my /home to a remote server. I will post some documentation on how to do this. At this time here are my notes with the error listed below:
1) Setup automatic ssh login for rsync scripts
a) Get automatic ssh login working:
http://www-128.ibm.com/developerworks/library/l-keyc2/
1] install KeyChain 'yum install keychain'
2] add entry to ~/.bash_profile
#example ~/.bash_profile file
/usr/bin/keychain ~/.ssh/id_rsa
#redirect ~/.ssh-agent output to /dev/null to zap the annoying
#"Agent PID" message
source ~/.ssh-agent > /dev/null
3] generate dsa and rsa keys: 'ssh-keygen -t dsa' 'ssh-keygen -t rsa'
4] Generate file to avoid error in keychain: 'touch ~/.ssh-agent' ???? Don't see this in notes.. but error went away.
b) Create rsync script
1] use 'source ~/.ssh-agent' to ensure that the cron job utilizes your keychain keys. ?? need this in script called by cron
2] create /etc/rsync.conf
# Global settings go here
use chroot = yes
max connect = 20
#syslog facility = local5
#pid file = /var/run/rsyncd.pid
# rsync 'module' options go here
[user]
path = /home/user/
comment = Home RSYNC Export
uid = user
gid = user
read only = no
4) Start rsync on server 'rsync --daemon'
5) run the client end of the command 'rsync -avz --stats --progress /home/user/directory/ root@remoteserver::user'
6) this will only copy updates from the local host /home/user directory
* Note: Changes on the remote host will not be evaluated or in anyway synced back to the local system
Issues:
I can't seem to get remote login to work I followed the instructions but I seem to be missing a piece of the puzzle. It use to be you just copied over your local .ssh/id_dsa.pub file into the remote server ~/.ssh/authorized_keys2 file and it worked... but it has been a number of years sense I have been in the trenches with linux (still getting back into the groove).
Reviewing my notes on the ssh setup... what did I do wrong?