0

I'm trying to deploy a rails application to my amazon EC2 instance. I just created it and the only action I took on it was to create the deploy user, that I'm going to use for capistrano. Everything works fine there, but I can't do ssh directly for that user, but only on my ubuntu user. I executed the ssh with -v param so I get the output:

ssh -v -i ~/Pems/hybrazil-impulso.pem deploy@35.160.22.104
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 35.160.22.104 [35.160.22.104] port 22.
debug1: Connection established.
debug1: identity file /home/ronanlopes/Pems/hybrazil-impulso.pem type -1
debug1: identity file /home/ronanlopes/Pems/hybrazil-impulso.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-sha1-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA bb:b3:01:95:2a:da:b5:ef:26:7c:06:51:36:f8:11:93
debug1: Host '35.160.22.104' is known and matches the ECDSA host key.
debug1: Found key in /home/ronanlopes/.ssh/known_hosts:21
debug1: ssh_ecdsa_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: Offering RSA public key: lopesronanufsj@gmail.com
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/ronanlopes/Pems/hybrazil-impulso.pem
debug1: key_parse_private2: missing begin marker
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 saw a similar issue here: AWS SSH connection error: Permission denied (publickey), but none of these answers worked for me... any idea how to fix it? Thanks!

EDIT:

Steps for create new user:

sudo adduser deploy
sudo adduser deploy sudo
Community
  • 1
  • 1
Ronan Lopes
  • 2,785
  • 2
  • 18
  • 45
  • Perhaps you should detail the steps you took to create the user. Did you create a new private key for the new user account? – Mark B Dec 07 '16 at 18:21
  • @MarkB Updated the question with the steps for creating user. Only created it and added it to sudo group. How should I create that new private key? Thanks! – Ronan Lopes Dec 07 '16 at 18:25
  • 1
    EC2 instances usually require ssh keys and have password authentication disabled. You would either need to enable password authentication in the `ssh` service configuration, or you would need to add an ssh key to the new user account. A quick search for either of those subjects should turn up what you need. – Mark B Dec 07 '16 at 18:28
  • Ok, for now I guess that will help me. If you post it as an answer, I'll be happy to accept it. Thanks! – Ronan Lopes Dec 07 '16 at 18:30

0 Answers0