LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Rsync With SSH Syntax? (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-with-ssh-syntax-4175465886/)

NotAComputerGuy 06-13-2013 12:21 PM

Rsync With SSH Syntax?
 
I'm looking to try and use Rsync to push data from my local computer to a remote computer through SSH, using a specific key and a specific port and I'm struggling.

Code:

rsync -rdtvu --delete -e ssh -p 22 -i /path/to/sshkey /media/local/media/ user@192.168.0.1:/media/remote/dir/
Returns this.:
Code:

Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]

I can ssh into the remote box fine using
Code:

ssh -p 22 -i /path/to/sshkey user@192.168.0.1

quantumsummers 06-13-2013 04:06 PM

You need to place the args to the -e switch in quotes. So, you should have:
Code:

rsync -rdtvu --delete -e "ssh -p 22 -i /path/to/sshkey" /media/local/media/ user@192.168.0.1:/media/remote/dir/
To make this easier for the future, you man want to add something to your ~/.ssh/config file. For example:

Code:

Host 192.168.0.1
    User username
    Port 22
    IdentityFile=/path/to/sshkey

Of course, port 22 is the default so you don't need to add that unless you use a non-standard port.

Cheers!

NotAComputerGuy 06-13-2013 04:13 PM

Thanks for the reply and the free handy tip! :)


All times are GMT -5. The time now is 08:34 AM.