Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am unable to access the server, getting a "Permission denied (publickey)." Error

I am able to access it on one system using the same .pem file, but it is giving error on my system.

$ sudo ssh -v -i ./InsticatorPublic.pem ubuntu@54.243.206.17
[sudo] password for puneet:
OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 54.243.206.17 [54.243.206.17] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file ./InsticatorPublic.pem type -1
debug1: identity file ./InsticatorPublic.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debian-7ubuntu1
debug1: match: OpenSSH_5.8p1 Debian-7ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 63:e9:f2:7f:ab:f2:43:44:9f:64:c7:8e:ad:c5:15:e9
debug1: Host '54.243.206.17' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ./InsticatorPublic.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

share|improve this question
1  
And you are sure this key is configured on the server? What's in the servers log? –  Hauke Laging May 30 '13 at 22:28
add comment

2 Answers

You may want to try looking in /var/log/auth.log to see why the key is being rejected. Most likely answers are that you haven't updated authorized_keys for the user with the required key, or that the authorized keys file has the wrong permissions.

share|improve this answer
add comment

The auth.log file looks like:

May 31 10:19:22 puneet-VirtualBox lightdm: pam_unix(lightdm:session): session opened for user lightdm by (uid=0)
May 31 10:19:22 puneet-VirtualBox lightdm: pam_ck_connector(lightdm:session): nox11 mode, ignoring PAM_TTY :0
May 31 10:19:23 puneet-VirtualBox lightdm: pam_succeed_if(lightdm:auth): requirement "user ingroup nopasswdlogin" not met by user "puneet"
May 31 10:19:23 puneet-VirtualBox dbus[791]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.27" (uid=104 pid=1664 comm="/usr/lib/indicator-datetime/indicator-datetime-ser") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination=":1.14" (uid=0 pid=1179 comm="/usr/sbin/console-kit-daemon --no-daemon ")
May 31 10:19:47 puneet-VirtualBox lightdm: pam_unix(lightdm:session): session closed for user lightdm
May 31 10:19:47 puneet-VirtualBox lightdm: pam_unix(lightdm:session): session opened for user puneet by (uid=0)
May 31 10:19:47 puneet-VirtualBox lightdm: pam_ck_connector(lightdm:session): nox11 mode, ignoring PAM_TTY :0
May 31 10:19:49 puneet-VirtualBox polkitd(authority=local): Registered Authentication Agent for unix-session:/org/freedesktop/ConsoleKit/Session2 (system bus name :1.46 [/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1], object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 10:19:52 puneet-VirtualBox dbus[791]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.58" (uid=1000 pid=2124 comm="/usr/lib/indicator-datetime/indicator-datetime-ser") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination=":1.14" (uid=0 pid=1179 comm="/usr/sbin/console-kit-daemon --no-daemon ")
May 31 10:45:36 puneet-VirtualBox gnome-screensaver-dialog: gkr-pam: unlocked login keyring
May 31 10:46:11 puneet-VirtualBox sudo: puneet : TTY=pts/1 ; PWD=/home/puneet/Insticator/GitConnect ; USER=root ; COMMAND=./connectdemo May 31 10:46:11 puneet-VirtualBox sudo: pam_unix(sudo:session): session opened for user root by puneet(uid=1000)
May 31 10:46:12 puneet-VirtualBox sudo: pam_unix(sudo:session): session closed for user root

share|improve this answer
    
It's an answer. You should edit the question to provide such information. –  automatix Jul 2 '13 at 16:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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