Recently got tired of having bookmarks on my my laptop and not on my desktop, podcasts on my desktop but not on my laptop and so on and so forth. So, I decided to use rsync to sync the two. I use my laptop most, so I started with that. I didn't want to rsync my entire /home/user/ directory, so I just chose to sync the apps that I wanted to be the same on both computers. So, I just wrote a simple bash script to sync the two. First, I got rid of the passwords when I rsync or ssh to the desktop. I used the command below.
ssh-keygen -t rsa
Do not enter password when prompted. from there,
cd ~/.ssh/ && cp id_rsa.pub laptop.key
Then put that key into authorized_key file on the remote computer. I had an nfs share of my home computer, so I just did it that way. You could use FTP, Thumbdrive, etc.
cat laptop.key >> authorized_keys
Once that is complete, repeat for both machines. You should then have 2 way passwordless communication via rsync & ssh.
here's the script I wrote.
#------------------------------- # Laptop / Desktop sync script # # gi_james@strickstuff.com #------------------------------- # Declare Variables amark="/home/james/.kde3.5/share/apps/amarok/" kopet="/home/james/.kde3.5/share/apps/kopete/" firefx="/home/james/.mozilla/" thunder="/home/james/.thunderbird/" school="/home/james/school/" # Begin sync ops echo "Syncing Amarok" rsync -arvuz $amark compaq:$amark echo "Syncing Firefox" rsync -arvuz $firefx compaq:$firefx echo "Syncing Thunderbird" rsync -arvuz $thunder compaq:$thunder echo "Syncing Kopete" rsync -arvuz $kopet compaq:$kopet echo "Syncing School Folder" rsync -arvuz $school compaq:$school echo " " echo " " echo " " echo "DONE!!!!!!!!!!!!!"
This script will sync the directories in the #delare variables section. Change those around accordingly. I know there are other methods, but this method is good enough for what I want to do. Please feel free to email me with a better method. I'm certainly not the most proficient bash scripter.
Oh, one more thing, before I started, I edited /etc/hosts and added the hostname of all computers on my network. That way, all I have to do is type ssh computername instead of ssh ipaddy and no password is needed.
Pages
Category
- Aikido (13)
- Family (36)
- General (67)
- Linux (18)
- Computer (3)
- Metal Detecting (1)
- Off Road (7)
- school (15)
- Travel (11)
- Uncategorized (1)
- Web (17)
- WII (2)
- work (22)
Archives
- January 2012
- December 2011
- August 2011
- April 2011
- November 2010
- October 2010
- September 2010
- July 2010
- June 2010
- May 2010
- February 2010
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- December 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- January 2007
- December 2006
- November 2006
