0

I´ve been trying to log in to a VM running Ubuntu in Azure from OS X through SSH verification. But when I try to connect to the virtual machine I get a Permission denied (publickey) error.

To create the key-pair certificate I did it through the terminal using the following steps:

openssl req -x509 -nodes -days 365 \
-newkey rsa:2048 \
-keyout example1.key \
-out example1.pem

Then I set the permissions:

chmod 600 example1.key

Both files are in my User folder.

During the VM creation I uploaded the file example1.pem.

After creating the VM, I try to connect using the following command:

ssh -v -i myPrivateKey.key -p 22 [email protected]

This is the output I get:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to ubuntuedx.cloudapp.net [23.99.90.218] port 22.
debug1: Connection established.
debug1: identity file myPrivateKey.key type -1
debug1: identity file myPrivateKey.key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH_5*
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: Server host key: RSA 20:b6:58:2c:96:75:f8:f6:b0:25:39:85:ed:ab:7a:9d
debug1: Host 'ubuntuedx.cloudapp.net' is known and matches the RSA host key.
debug1: Found key in /Users/juanse/.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: 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: myPrivateKey.key
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

I have tried using the VIP instead of the VM name, but I get the same output. I have looked all over the internet for an answer of what's going on here but I have found no solutions to my problem.

1 Answer 1

0

I have to ask since it wasn't stated.. Did you add your public key during the VM creation? There is a step where you would upload example1.pem and it then gets stored in in the user's ~/.ssh/authorized_keys file during installation.

1
  • Yes, I added the public key, in this case the file example1.pem during the VM creation.
    – jsrojas1
    Commented May 22, 2015 at 21:17

You must log in to answer this question.