0

I have somehow killed my ssh key login while tinking with rsync. Here is the rsync command I ran. (I Control-C'd as soon as I saw it working):

rsync -avz -e "ssh -i .ssh/id_rsa.pub -p XXXX" --progress ./ user@SERVERNAME/home/user/

After which I get the following error when trying to ssh in

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

the perms on the server are as follows,

.ssh:

drwx------  2 frank frank 4096 Nov 22 06:01 .
drwxrwxr-x 35 frank frank 4096 Nov 22 06:23 ..
-rw-------  1 frank frank 3893 Nov 22 05:50 authorized_keys
-rw-------  1 frank frank 1675 Oct 21  2016 id_rsa
-rw-r--r--  1 frank frank  397 Oct 21  2016 id_rsa.pub
-rw-r--r--  1 frank frank  420 Nov 22 06:26 known_hosts

~/:

drwx------  2 frank frank  4096 Nov 22 06:01 .ssh

Couple of quick notes about my set up:

1) nonstandard ssh port 2) no password logins

  • What do the logs on your server say about the login ? – Iain Nov 22 '17 at 6:32
  • that did it. The error was bad ownership or modes for directory so I chmoded it. If you want to write it up I'll mark you answer – Frank Conry Nov 22 '17 at 6:57
2

In cases like this it is often easier to diagnose the issue by looking in the server's logs, rather than attempting to fiugre stuff out from the client side.

  • I'm on centOS so tailed /var/log/secure and got bad ownership or modes for directory turns out rsync had changed the permissions fo my home directory. – Frank Conry Nov 22 '17 at 14:15
0

Note that either there is a protective feature or a bug with Rsync when transferring using -a into the root folder.

Given a local folder call Music containing cow.txt

rsync -a Music/ root@134.209.12.183:/usr/ 

moves the cow.txt file in the music folder in to usr/ and I can still log in.

rsync -a Music/ root@134.209.12.183:/root/ 

moves the cow.txt file into /root/ and the authorized keys are not affected but I cannot log in subsequently with ssh@root134.209.12.183.

I'm not sure why this happens and couldn't see anything in the log on the server that would explain it.

But at least it's easy to avoid the issue

Both the remote and local server and running rsync version 3.1.1 protocol version 31

on Ubuntu 16.04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.