Search code examples
sshconnectionrsync

Rsync Won't Connect


I've just set up a new website on SiteGround and am trying to sync files to it from another server, however, when running the command, I'm getting the following error:

Enter passphrase for key '/cygdrive/c/Users/Example User/.ssh/id_rsa':
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at /home/lapo/packaging/rsync-3.0.4-1/src/rsync-3.0.4/io.c(632) [sender=3.0.4]

The passphrase is definitely correct.

Here's the rsync command that I'm running:

rsync -avz --exclude-from='exclude.txt' -e 'ssh -p 1234' test/test.txt user@host:/home/user/www/sitename/public_html/

I know my keys and passphrase are correct because I'm able to ssh on to the server with no issues, using the following command:

ssh user@host -p 1234

I've tried many tweaks to the rsync code such as making sure there are trailing slashes, that the directories exist. I've tried it both with -avz and without. I've also tried a key without a passphrase.

I also thought that maybe Siteground is blocking things but rsync is available on the server so I don't know why this would be.

Unfortunately, despite being able to SSH to the server, rsync simply won't even though it's using the same key, passphrase and port.

Where am I going wrong?


Solution

  • I've managed to connect now and should anyone else run into the issue, the fix I found worked for me was to create a new SSH key outside of the Users directory. I'm putting this down to permissions, as soon as I move it to the the C drive in it's own folder, everything worked as expected!