Please help me understand how I can solve my SSH problem:
I can SSH into my EC2 instance running Ubuntu 10.10 'Maverick Meerkat' no problem with:
$ ssh -i MyEC2Key.pem ubuntu@ec2-01-LALALALALALA.eu-west-1.compute.amazonaws.com
My issue arises when I try the same thing with the new user that I have created:
$ ssh -i MyEC2Key.pem robert@ec2-01-LALALALALALA.eu-west-1.compute.amazonaws.com
Unfortunately when trying this I get the following error message:
Permission denied (publickey).
I don't understand what I am missing and am relatively new to most of this stuff. All I want is for this new user to have admin rights and full SSH access. These are the steps I have gone through, all remotely logged in as user ubuntu and doing edits with vim. If someone could let me know what I am missing or have misunderstood here it would much appreciated.
- I have created a new user called robert
- I have added that user to the group admin
I have added the following to
/etc/sudoers
root ALL=(ALL) ALL (that line was already there) robert ALL=(ALL) ALL (that line was what I added)
I have added the following line to
/etc/ssh/sshd_config
AllowUsers robert ubuntu root
I have restarted the ssh daemon
- I have logged out as ubuntu and attempted to ssh back in as robert in a new terminal
Still stuck. Just to sanity check, yes I can log in as robert by SSHing in as ubuntu and using sudo su robert but that is not what I require - I need to be able to SSH in as robert direct.
Here is the debug stuff from attempting to SSH in as robert with debug flags:
$ ssh -v -i MyEC2Key.pem robert@ec2-01-LALALALALALA.eu-west-1.compute.amazonaws.com
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to ec2-01-LALALALALALA.eu-west-1.compute.amazonaws.com [XX.XXX.XX.XXX] port 22.
debug1: Connection established.
debug1: identity file MyEC2Key.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-4ubuntu4
debug1: match: OpenSSH_5.5p1 Debian-4ubuntu4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
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: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-01-LALALALALALA.eu-west-1.compute.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/robmccardle/.ssh/known_hosts:4
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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: MyEC2Key.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).