Rsync and SSH – Passwordless Login


Making remote copies

What if you want to copy files offsite to a remote host? No problem — all you need to do is add the host and user information. So, for instance, if you want to copy the same directory to a remote host, you’d use:

rsync -ave ssh –delete /home/user/dir/ user@remote.host.com:dir/

If you want to know how fast the transfer is going, and how much remains to be copied, add the –progress option:

rsync –progress -ave ssh –delete

/home/user/dir/ user@remote.host.com:dir/

Passwordless SSH

If you don’t want to be prompted for a password each time rsync makes a connection — and you don’t — make sure that you have rsync set up to log in using an SSH key rather than a password. To do this, create an SSH key on the local machine using

ssh-keygen -t dsa

and press Enter when prompted for a passphrase. After the key is created, use

ssh-copy-id -i .ssh/id_dsa.pub user@remote.host.com

to copy the public key to the remote host.

*********************
What if you need to bring back some of the files you copied using rsync? Use the following syntax: (z) is compression

rsync -avze ssh remote.host.com:/home/user/dir/ /local/path/

The z option compresses data during the transfer. If the file you are copying exists on the local host, then rsync will just leave it alone — the same as if you were copying files to a remote host.

For Thecus N5550-orN5200 Rsync you must copy the key to the module location for it to work right.

-1st you have to install the two modules here
-change the password of the default “sys” user from the thecus web interface
-add an existing user by changing the password in the SYSUSER module.
at the machine you want to connect from type:

ssh-keygen -t dsa
scp .ssh/id_dsa.pub user@THECUS-IP:/raid/data/module/SSHD/system/etc/ssh/

ssh into the Thecus unit and then type:

cd /raid/data/module/SSHD/system/etc/ssh
cat id_dsa.pub >> authorized_keys

you should now be able to login without a password

new module

scp .ssh/id_dsa.pub root@IP:/raid/data/module/FaJoSSHD/system/etc/ssh/

cd /raid/data/module/FaJoSSHD/system/etc/ssh
cat id_dsa.pub >> authorized_keys

,

2 responses to “Rsync and SSH – Passwordless Login”

Leave a Reply

Your email address will not be published. Required fields are marked *