You are not logged in.
Hey Folks!
There seem to be a lot of posts up here regarding problems using SSH Key Pairs. I have read all that I could find on the arch forums, and done a bunch more general searching before hand in the wiki and on the web, and I'm still stuck on this one. I am attmepting to connect two arch linux computers over a home network. One is an rsync'd copy of the other with a few extra packages here and there. Without requiring the public key, I can connect to each computer without problems.
I have a static IP on the client, I actually haven't set that up for the server just yet - I will eventually set it up with a static IP, for now I'm leaving it dynamic since this computer is just going to be used as a base image for other computers around the appartment.
Commands Issued
-----------------
# Create Keypair + copy to client
ssh-keygen -t ecdsa -b 521 -C "$(whoami)@$(hostname)-$(date -I)"
ssh-copy-id -p 22 user@wintermute
# Adjusting privileges
#client
chown user:user /home/user
chown -R user:user /home/user/.ssh
chmod 755 /home/user
chmod 700 /home/user/.ssh
chmod 600 /home/user/authorized_keys
#server
chown user:user /home/user
chown -R user:user /home/user/.ssh
chmod 755 /home/user
chmod 700 /home/user/.ssh
chmod 600 /home/user/id_ecdsa
chmod 600 /home/user/id_ecdsa.pub
# Starting sshd
sudo /usr/bin/sshd -dddp 2222 -f /etc/ssh/sshd_config
# Attempting to connect
ssh -p 2222 -i /home/user/.ssh/authorized_keys user@tabatha
ssh -p 2222 -i /home/user/.ssh/authorized_keys user@192.168.1.68Relevant sshd_config
------------
AuthorizedKeysFile .ssh/authorized_keys #I found that if I used ~/.ssh/authorized_keys it searched in root
PasswordAuthentication no
PermitEmptyPasswords no
UsePAM yes # Although I tried it without, and it made no differenceRelevant output from ssh -vvv
------------------------------------
debug1: Server host key: ECDSA 4c:d2:73:92:17:ab:cc:f9:20:55:12:10:97:77:5a:a9
debug1: Host '[192.168.1.68]:2222' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:3
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/user/.ssh/authorized_keys (0x1779800), explicit
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering ECDSA public key: /home/user/.ssh/authorized_keys
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).Relevant output from sshd -ddd
-------------------------------
debug1: trying public key file /home/user/.ssh/authorized_keys
debug1: Could not open authorized keys '/home/user/.ssh/authorized_keys': No such file or directory
debug1: restore_uid: 0/0
Failed publickey for user from 192.168.1.118 port 55566 ssh2: ECDSA 25:a2:76:65:78:ee:d7:ea:11:bf:6b:68:7f:53:ec:99
debug3: mm_answer_keyallowed: key 0x217b610 is not allowed
debug3: mm_request_send entering: type 23
debug2: userauth_pubkey: authenticated 0 pkalg ecdsa-sha2-nistp521 [preauth]
debug3: userauth_finish: failure partial=0 next methods="publickey" [preauth]
Connection closed by 192.168.1.118 [preauth]
debug1: do_cleanup [preauth]
debug3: PAM: sshpam_thread_cleanup entering [preauth]
debug1: monitor_read_log: child log fd closed
debug3: mm_request_receive entering
debug1: do_cleanup
debug1: PAM: cleanup
debug3: PAM: sshpam_thread_cleanup entering
debug1: Killing privsep child 17506If anyone has experienced anything similar or had any suggestions, I would really appreciate any help I can get. I'm sure that I have just done something stupid here or there, but I'm having a heck of a time tracking it down. Thank you so much.
Last edited by kaivai (2013-10-25 10:19:03)
Offline
You haven't set the correct port in sshd_config: 2222.
Offline
Hi
I think you did it a bit wrong:
Your private key has to be on the client (thats why it's called private).
The authorized_keys file resides on the server.
Normally the ssh-copy-id command is executed on the client.
Offline
jasonwryan:
Nope! That's a good shot though, I didn't post the port number I was using, the 2222 was just for the debug version of sshd.
wirr:
That's it exactly! I have been doing it backwards the whole time.
This all make so much more sense. I tested the whole process a day earlier where I had exchanged keys with both computers and it worked, but when I was trying to authenticate with just one computer it wasn't. I was always puzzled when it asked me for the passphrase when going from the server to the client! It also makes sense that the public key I was trying to authenticate with when I did it manually, looked so much different from the existing one that had been sent over with ssh-copy-id. The signs were all there and I missed every one of them.
Thank you so much both of you!
So I guess this means that I will need to temporarily turn on accepting passwords, or manually enter the private key into authorized_keys every time that I want to connect to a new computer?
Offline