0

Am having some issues connecting to a linux instance in AWS via mobaxterm. I get the following error when trying to SSH on to the server;

─
[2018-02-16 10:07.57]  ~
[bunde.DESKTOP-A0APQ1T] ➤ ssh -v -i "XYZ.pem" servername.eu-west-2.compute.amazonaws.com
OpenSSH_7.1p2, OpenSSL 1.0.1g 7 Apr 2014
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to servername.eu-west-2.compute.amazonaws.com [x.x.x.x] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /var/keys/.10996.ssh type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/keys/.10996.ssh-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to servername.eu-west-2.compute.amazonaws.com:22 as 'bunde'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 zlib@openssh.com
debug1: kex: client->server aes128-ctr hmac-sha1 zlib@openssh.com
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256: ...
debug1: Host 'servername.eu-west-2.compute.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/mobaxterm/.ssh/known_hosts:1
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: pubkey_prepare: ssh_fetch_identitylist: agent refused operation
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /var/keys/.10996.ssh
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
**Permission denied (publickey).**

Any ideas? I've tried playing around with file permissions (I know from my mac the keys have to be well locked down), but any changes dont seem to impact the error I am getting.

Tux_DEV_NULL
  • 1,093
  • 7
  • 11
Dave H
  • 1
  • 1
  • 1
  • 1

2 Answers2

0

Uninstall Mobaxterm. Re-install somewhere not under Programs, because you don't have write access to there anymore.

0

It looks like your problem is in file permissions, could you check via mobaxterm that the key located in the folder that your are trying to run ssh command?

Run a ls -lh from Mobaxterm console and check file XYZ.pem exists with owner and group of the user that is running mobaxterm, besides with permissions 600 (-rw-------).

I'm not an expert in MAC, although, I'm pretty sure it has an ssh client by default, look at this link

Alvaro Niño
  • 359
  • 2
  • 6
  • Apologies I didnt make a couple of things clear. I am using a windows 10 PC for this particular task - My reference to my mac was just to note that I am aware of some restrictions on key permissions for SSH access. I ran ls -l from mobaxterm to provide a little more verbose output, and here's the result of the key in question; -rw-r--r-- 1 bunde UsersGrp 1460 Feb 16 09:58 ec2ora.pem for reference 'bunde' is indeed the user running mobaxterm. – Dave H Feb 17 '18 at 22:07
  • I don't know why Mobaxterm doesn't allows you to add your keys, look like the problem is in `debug1: pubkey_prepare: ssh_fetch_identitylist: agent refused operation` Could you try this commands? ` `eval 'ssh-agent -s'` `ssh-add XYZ.pem` after that, try to login again. If it doesn't work, please run ssh command with -vvv an share output – Alvaro Niño Feb 19 '18 at 09:12
  • So i've gone to do the testing you suggested, and connecting worked first time. When I loaded Mobaxterm, for reasons unknown, I right-clicked the .exe and opted to run as administrator - Its possible this was the issue. However, reloading the app without doing this yields the same results. I've double-checked file permissions and they remain unchanged. – Dave H Feb 21 '18 at 08:54
  • it looks like an issue in your Mobax... which version are you using?? if it helps you, please vote – Alvaro Niño Feb 21 '18 at 09:06