Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old May 15th, 2008   #1
50words
Gee! These Aren't Roasted!
 
50words's Avatar
 
Join Date: Feb 2007
Location: Minneapolis, MN
Beans: 191
Ubuntu 7.10 Gutsy Gibbon
Send a message via AIM to 50words Send a message via Skype™ to 50words
HowTo: Use Grsync and OpenSSH to sync your /home directory over a network

This tutorial will cover three things:

1) installing rsync, the Grsync GUI for rsync, and OpenSSH;
2) using rsync over an OpenSSH connection to syncronize your /home directory between two computers; and
3) excluding files you do not want to sync.

Reason: I use a desktop and a laptop. I want to keep my /home directory on both identical, since I use the same software, etc., on both. OpenSSH provides a secure connection if you are syncing remotely over the internet, and is a really easy way to connect to another computer on your network.

1) Installing rsync, Grsync, and OpenSSH

This is a piece of cake. Copy each of the following lines into the terminal:

Code:
sudo apt-get install grsync
sudo apt-get install openssh-server
2) Now, open up Grsync, which will be in Applications > Internet in Ubuntu, or you can hit Alt+F2 to bring up the run menu and type "grsync".

Click the +Add button and name your new session something like "50words /home" so you can easily get to it again.

In the Source and Destination fields, enter the source--the computer you are going to sync from--in the first field. In my case:

Code:
/home/50words/
Note: you must add the trailing slash if you want to copy the contents of a directory.

In the destination field--the second field--enter the computer you are going to sync to. You have to do this using the computer's IP address. (If you don't know it, use the ifconfig command in a terminal. Or use System > Administration > Network Tools, and select the Network Device to see your IP Address next in the IPv4 row, if you are using Ubuntu.)

Enter it like so:

Code:
192.168.0.10:/home/50words/
Now, in order to get SSH to work, you have to click on the Advanced Options tab in Grsync and enter the following in the Additional options field:

Code:
-e ssh
I also check "Copy symlinks as symlinks", because I want the /home directories to be identical, right down to the links in them.

3) Now, there are almost certainly some files you do not want to sync. For example, it is time-consuming to sync my Firefox cache, so I don't do it; I have a fast internet connection, so it does not really matter to me if it is synced up.

It takes a lot of text to exclude multiple files and folders using the command line. It is easier to use a separate file to identify the files and folders to exclude.

First, in the Additional options field, enter "--exclude" and the text file name in which you will list your files or directories to exclude. For example, here is my path to my exclusion file:

Code:
--exclude-from=/home/50words/rsync-exclude.txt
In that text file, just identify the files or directories you want excluded. Wildcards work. Remember that rsync will navigate relative to the directory in which it starts (the directory you identified as the source directory). Here is an example of the contents of an exclusion file:

Code:
/home/50words/.mozilla/firefox/*/Cache
/home/50words/.beagle
So there you go. Before you sync for real, use the "Simulation" button to make sure you don't get any errors, and take a look at the output to make sure you aren't accidentally deleting everything.

Edit: If you want to do a two-way sync, instead of a one-way sync, give Unison a try. It works just as well over SSH, and does a fantastic job of two-way syncing.

Last edited by 50words; October 10th, 2008 at 11:24 AM..
50words is offline   Reply With Quote
 

Bookmarks

Tags
how to, rsync, ssh

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:07 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry