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
/home/intex
$ 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

(more…)

Advertisements

Blog at WordPress.com.