I'm having trouble setting up public key authentication for an SSH server on Ubuntu Server 12.04 (A) for authentication from an Ubuntu Server 13.04 (B).
What I'm doing now (I'm trying to follow the instructions here):
- On B: Create a new key with
ssh-keygen -C ""
, using no passphrase, writing to/.ssh/id_rsa
- I don't get any errors - On B: Run
ssh-copy-id -i /.ssh/id_rsa user@host-a
- also, a success message - On B:
ssh -i /.ssh/id_rsa user@host-a
- I still have to enter my password foruser@host-a
On A, I checked if the /.ssh/authorized_keys
is modified after running ssh-copy-id
, and this is the case. Also, on both devices I added this to /etc/ssh/sshd_config
:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /.ssh/authorized_keys
Does anyone know what might be the problem here?
Here's the tail of my /var/log/auth.log
on machine A:
Jun 13 22:17:56 laptop-camil sshd[12344]: Server listening on 0.0.0.0 port 22.
Jun 13 22:17:56 laptop-camil sshd[12344]: Server listening on :: port 22.
Jun 13 22:18:27 laptop-camil sshd[12345]: Authentication refused: bad ownership or modes for directory /.ssh
Jun 13 22:18:30 laptop-camil sshd[12345]: Accepted password for camilstaps from 164.138.27.37 port 48407 ssh2
Jun 13 22:18:30 laptop-camil sshd[12345]: pam_unix(sshd:session): session opened for user camilstaps by (uid=0)
Jun 13 22:18:35 laptop-camil sshd[12464]: Received disconnect from 164.138.27.37: 11: disconnected by user
Jun 13 22:18:35 laptop-camil sshd[12345]: pam_unix(sshd:session): session closed for user camilstaps
Jun 13 22:18:42 laptop-camil sshd[12516]: Authentication refused: bad ownership or modes for directory /.ssh
Jun 13 22:18:44 laptop-camil sshd[12516]: Connection closed by <host-b> [preauth]
sudo -s
. I'm editing/.ssh
, but both the root and the camilstaps user have homedir/
, so that would be the same as~user/.ssh
if I'm not mistaken.sudo -s
on the local host B, and try to login tocamilstaps@laptop-camil
(remote host A). On B,root
owns/.ssh
. On A,camilstaps
owns/.ssh
.