Reputation: 15
Unable to connect to SSH through Ubuntu. But it works fine on MAC.
My Config File
Host testserver
User ubuntu
IdentityFile '/home/kavin/.ssh/AnotherKey.pem'
HostName ec2-54-201-xxx-xxx.us-west-2.compute.amazonaws.com
Connecting through SSH
$ ssh testserver
This is same i did for Mac and for my Ubuntu. It works perfectly in Mac but in Ubuntu an error is thrown Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Now i tried the alternate way ssh -i '/home/kavin/.ssh/AnotherKey.pem' [email protected]
This works fine in both Mac and Ubuntu.
Can you please tell me where i went wrong
These are the logs of $ ssh testserver -v
OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/kavin/.ssh/config
debug1: /home/kavin/.ssh/config line 1: Applying options for testserver
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-54-200-26-1.us-west-2.compute.amazonaws.com [54.200.26.1] port 22.
debug1: Connection established.
debug1: identity file '/home/kavin/.ssh/AnotherKey.pem' type -1
debug1: identity file '/home/kavin/.ssh/AnotherKey.pem'-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.1p1 Debian-4
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 90:e1:d7:01:ab:cf:eb:2c:4b:8f:b2:5e:ad:05:a5:b8
debug1: Host 'ec2-54-200-26-1.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/kavin/.ssh/known_hosts:10
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: '/home/kavin/.ssh/AnotherKey.pem'
debug1: No more authentication methods to try.
Upvotes: 1
Views: 1752
Reputation: 344
Goto Terminal:
copy paste:
Host testserver
HostName ec2-54-201-xxx-xxx.us-west-2.compute.amazonaws.com
User ubuntu
IdentityFile /etc/ssh/AnotherKey.pem
save - exit
open new terminal
sudo -i
enter password
cd /etc/ssh
chmod 400 'your-key'
ssh testserver
-- make sure your 22 port is open
https://askubuntu.com/questions/410218/how-to-close-an-open-port-in-ubuntu-12-04
Upvotes: 1
Reputation: 10015
As you say,
ssh -i '/home/kavin/.ssh/AnotherKey.pem' [email protected]
from ubuntu m/c works and ssh testserver
fails. I would suggest comment other lines from config file and just keep
IdentityFile /home/kavin/.ssh/AnotherKey.pem
Make sure, you remove the quotes and the path should directly be available to key.
Upvotes: 0