Kunaljain's Weblog

August 2, 2007

Rsync and SSH

Filed under: Rsync and SSH — Kunal Jain @ 01:37

This document covers using ssh and rsync to transfer files over a local network or the internet.
This will to ensure no user interven
tion required when the computer is restarted (for passwords, keys)

Using Rsync and SSH

Suppose we have two machines named box and host name is box.com and username is box1 and
the other is intex and host name is intex.com and user name is watt

Generating public and private key at box machine with box1user
-> $ssh-keygen -t dsa -b 2048 -f /home/box1/box-dsa-key

***(Where box-dsa-key is the name of the key)***

Generating public/private dsa key pair
Enter passphrase (empty for no passphrase):[Press Enter Here]
Enter same passphrase again: [Press Enter Here]
Your identification has been saved in /home/user/box-dsa-key
Your public key has been saved in /home/user/box-dsa-key.pub
The key fingerprint is:
2e:28:d9:ec:85:21:e7:ff:73:df:2e:07:78:f0:d0:a0 user@box.com

-> cd .ssh

-> cp /home/box1/box-dsa-key /home/box1/.ssh/

-> mv box-dsa-key id_dsa

-> scp /home/user/box-dsa-key.pub watt@intex.com:/home/watt/

-> i am now watt user at intex.com
$ pwd
$ if [ ! -d .ssh ]; then mkdir .ssh; chmod 700 .ssh; fi
$ mv box-dsa-key.pub .ssh/
$ cd .ssh/
$ if [ ! -f authorized_keys ]; then touch authorized_keys; chmod 600 authorized_keys; fi
$ cat box-dsa-key.pub>>authorized_keys

-> i am now box1 user at box.com
to check whether above configuration works or not type the following command
ssh watt@intex.com

-> Script to transfer data




Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: