scp freezes and empty file created - raspberry-pi3

Hy,
I need to put a file using scp from a ubuntu 18.04 server to a Raspberry, the file is created in the destination directory but it is at 0 bytes and scp freezes.
This is the scp command:
scp -v /home/solergy/MANGO/MA_HOME_TERLIZZI/STM32_BINARIES/S07E-MCU-3AX.bin solergy#172.16.9.14:/home/solergy/ARTESHELL_IP/bin/
and this is the log on Ubuntu server sending the file:
Executing: program /usr/bin/ssh host 172.16.9.14, user
solergy, command scp -v -t /home/solergy/ARTESHELL_IP/bin/
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 172.16.9.14 [172.16.9.14] port 22.
debug1: Connection established.
debug1: identity file /home/solergy/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/solergy/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Raspbian-10+deb9u6
debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 172.16.9.14:22 as 'solergy'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecds..........256 SHA256:GLpj.......................o1ng
debug1: Host '172.16.9.14' is known and matches the ECDSA host key.
debug1: Found key in /home/solergy/.ssh/known_hosts:14
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:N0Ci............ihb/zI1DB..........Pc /home/solergy/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/solergy/.ssh/id_dsa
debug1: Trying private key: /home/solergy/.ssh/id_ecdsa
debug1: Trying private key: /home/solergy/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: Authentication succeeded (password).
Authenticated to 172.16.9.14 ([172.16.9.14]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00#openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -t /home/solergy/ARTESHELL_IP/bin/
Sending file modes: C0777 189264 S07E-MCU-3AX.bin
Sink: C0777 189264 S07E-MCU-3AX.bin
And this is the empty file created:
Any idea about where is the problem and how I can solve it.
Thanks,
Antonio

what is strange is that I've no problem using ssh to access the remote server, instead scp is not working.

Related

unable to SSH into aws ec2 instance with gitbash: permission denied

I encountered the permission denied error while trying to ssh into my aws ec2 instance - centos with a valid private key (.pem) file using the windows gitbash. Debug logs are as given below.
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ec2-#####.ap-south-1.compute.amazonaws.com [####] port 22.
debug1: Connection established.
debug1: identity file mbrace.pem type -1
debug1: identity file mbrace.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to ec2-13-126-107-143.ap-south-1.compute.amazonaws.com:22 as 'centos'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:5Qu3MuE9zz27Ywx1d+dQyZwaC8KN/khaRLIRSUVLZ6s
debug1: Host 'ec2-13-126-107-143.ap-south-1.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/####/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: mbrace.pem explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Trying private key: mbrace.pem
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
centos#ec2-######.ap-south-1.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Another reference file knownhosts file contents is as given below
.ssh/config/known_hosts
ec2-13-126-107-143.ap-south-1.compute.amazonaws.com,13.126.107.143 ecdsa-sha2-nistp256
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlz..........
Update
On advise from VONC, created a new key pair using ssh-key gen tool, which generated a .pub file and subsequently imported the key to aws ec2 successfully. On trying the command again, permission denied is the same result, though the logs change a bit. Here are the logs:
$ ssh -i "C:/Users/mbrace/.ssh/mbrace2.pem" centos#ec2-13-126-107-143.ap-south-1.compute.amazonaws.com -v
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ec2-13-126-107-143.ap-south-1.compute.amazonaws.com [13.126.107.143] port 22.
debug1: Connection established.
debug1: identity file C:/Users/mbrace/.ssh/mbrace2.pem type -1
debug1: identity file C:/Users/mbrace/.ssh/mbrace2.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to ec2-13-126-107-143.ap-south-1.compute.amazonaws.com:22 as 'centos'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:5Qu3MuE9zz27Ywx1d+dQyZwaC8KN/khaRLIRSUVLZ6s
debug1: Host 'ec2-13-126-107-143.ap-south-1.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/mbrace/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: C:/Users/mbrace/.ssh/mbrace2.pem explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Trying private key: C:/Users/mbrace/.ssh/mbrace2.pem
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
centos#ec2-13-126-107-143.ap-south-1.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Tried all methods given in the forum including changing permissions of .ssh folder and .pem file, but to no use. Do guide us as where we are going wrong.
Update 2
Just as you mentioned, recreated the key without any extension "mbrace2" and imported the .pub key to ec2 successfully under "key pairs". Now when we try to ssh into the server again, we encounter the same error (permission denied). Based on other answers, i also tried changing permissions of the key to 400,500,600 but there was no change in the status.
Also, when we add this code ^^^ (.no pub) at the end, it gives me this error:
bash: syntax error near unexpected token `('. So had to run the earlier said command without it.
Do guide us as where we are going wrong.
Update 3
As asked by you, here is the command and its corresponding output.
The Command
$ ssh -i "C:/Users/mbrace/.ssh/mbrace2" centos#ec2-13-126-107-143.ap-south-1.compute.amazonaws.com -Tv
The Output
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ec2-13-126-107-143.ap-south-1.compute.amazonaws.com [13.126.107.143] port 22.
debug1: Connection established.
debug1: identity file C:/Users/mbrace/.ssh/mbrace2 type 0
debug1: identity file C:/Users/mbrace/.ssh/mbrace2-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to ec2-13-126-107-143.ap-south-1.compute.amazonaws.com:22 as 'centos'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:5Qu3MuE9zz27Ywx1d+dQyZwaC8KN/khaRLIRSUVLZ6s
debug1: Host 'ec2-13-126-107-143.ap-south-1.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/mbrace/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: C:/Users/mbrace/.ssh/mbrace2 RSA SHA256:+47/xVuTP15NDpN+2OZbSOIfQ9umTAi6P+i8vufO6q8 explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Offering public key: C:/Users/mbrace/.ssh/mbrace2 RSA SHA256:+47/xVuTP15NDpN+2OZbSOIfQ9umTAi6P+i8vufO6q8 explicit
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
centos#ec2-13-126-107-143.ap-south-1.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Will attempt key: mbrace.pem explicit
That means you have a /c/Users/####/.ssh/config file which does explicitly reference in an IndentityFile filed the mbrace.pem file.
You need to make sure, following "EC2: Connect to your Linux instance using SSH", that (to emulate ssh -i /path/my-key-pair.pem my-instance-user-name#my-instance-public-dns-name):
the remote user (field User in the SSH config file) is the correct one (my-instance-user-name)
the key (private mbrace.pem in IdentityFile) is referenced through its full path (~/.ssh/mbrace.pem works, even on Windows)
the matching public key is visible in the .ssh/authorized_keys file on the instance.
the inbound SSH traffic from your IP address to your instance is enabled
To test a new key, you new to use its private key:
ssh -i "C:/Users/mbrace/.ssh/mbrace2" my-instance-user-name#my-instance-public-dns-name -v
^^^ (no .pub)

ssh Authentication failed on Mac

I tried to ssh a remote linux server with username and password on my Mac. But it shows the following mistake. It seems that it tries to login with rsa keys. But I want to login with password. (I can successfully login with password in Xshell in windows)
SSH command:
ssh -v -p 10022 qhdxliy#42.123.106.11
Debugging output:
OpenSSH_7.5p1, LibreSSL 2.5.4
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug1: Connecting to 42.123.106.11 [42.123.106.11] port 10022.
debug1: Connection established.
debug1: identity file /Users/zhaokai/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/zhaokai/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_100.0
debug1: match: OpenSSH_100.0 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 42.123.106.11:10022 as 'qhdxliy'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64#openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64#openssh.com compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:iqMu6xmkaocbmHW4ejr0REqMGiIBVgaBz4CkocSwopI
debug1: Host '[42.123.106.11]:10022' is known and matches the RSA host key.
debug1: Found key in /Users/zhaokai/.ssh/known_hosts:7
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/zhaokai/.ssh/id_rsa
Authentication failed.
The password auth is tried after the public key. If you don't want your ssh client to try your public key first, use the PreferredAuthentications option, i.e.
ssh -o "PreferredAuthentications=password" [other options... ]
Source: the AUTHENTICATION section of ssh's manual page states:
The methods available for authentication are: GSSAPI-based authentication, host-based authentication, public key authentication, challenge-response authentication, and password authentication.
Authentication methods are tried in the order specified above, though PreferredAuthentications can be used to change the default order.

password less login not working on mac

I created public and private keys and updated the public keys in the authorised keys file on the server. But when I try to access the server from my Mac I am still getting the prompt to login. When I try to debug, I am getting the below log message.
Pradeep:~ pkumar$ ssh -v pradeep#10.21.21.46
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 10.21.21.46 [10.21.21.46] port 22.
debug1: Connection established.
debug1: identity file /Users/pkumar/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/pkumar/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2
debug1: match: OpenSSH_7.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.51.1.36:22 as 'pradeep'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256#libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:MkMVA3YQfMFzUv3IxILEVdo0VBr1+aHuQP4YTCbZJg4
debug1: Host '10.21.21.46' is known and matches the RSA host key.
debug1: Found key in /Users/pkumar/.ssh/known_hosts:14
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password
debug1: Next authentication method: password
pradeep#10.21.21.46's password:
Where am I going wrong.
debug1: Authentications that can continue: password
This says that either client or server does not support public key authentication. Client is probably ok, unless you modified your /etc/ssh/ssh_config.
If you have access to the server configuration, check the server /etc/ssh/sshd_config and make sure there is enabled PubkeyAuthentication yes.

Using SSH Keygen not able to connect to server on Windows 10 GIT

I'm following below tutorial.
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
It's generated file on Windows 10 C:\Users\<user name>\.ssh
I'm using GIT to generate files.
~/Desktop
$ PermitRootLogin without-password
bash: PermitRootLogin: command not found
$ ssh a#b.com
a#b.com's password:
Permission denied, please try again.
I have generated .ppk file using puttygen.exe.
Still not able to connect to server.
By doing ssh -Tv a#b.com
It will give below response
OpenSSH_7.1p2, OpenSSL 1.0.2h 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to a#b.com [XXX.XXX.XXX.XX] port 22.
debug1: Connection established.
debug1: identity file /c/Users/XUser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519-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_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to a#b.com:22 as 'XUser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305#openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305#openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:WrjAO7ldoJ3vjYENd6v7JvxXkbquvvom16RYGKeRO70
debug1: Host 'a#b.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/XUser/.ssh/known_hosts:2
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,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/XUser/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/XUser/.ssh/id_dsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ed25519
debug1: Next authentication method: password
XUser#a#b.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
XUser#a#b.com's password:
If you do have
your public key: C:\Users\<user name>\.ssh\id_rsa.pub
your private key: C:\Users\<user name>\.ssh\id_rsa
Do copy your public key (see "How To Use SSH Keys with DigitalOcean Droplets")

Can't SSH into AWS Permission denied (publickey)

Trying to deploy my first web app and am having difficulty SSH into AWS. When I enter:
ssh -v -i ec2-myportfolio.pem root#ec2-23-23-165-24.compute-1.amazonaws.com
I get Permission denied(public key). I looked at a couple of the other responses on stack over flow like
this and this, but neither resolved the issue. Below is the error I get. Thanks in advance for the help.
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
Warning: Identity file ec2-myportfolio.pem not accessible: No such file or directory.
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-23-23-165-24.compute-1.amazonaws.com [23.23.165.24] port 22.
debug1: Connection established.
debug1: identity file /Users/jonathanschen/.ssh/id_rsa type 1
debug1: identity file /Users/jonathanschen/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jonathanschen/.ssh/id_dsa type -1
debug1: identity file /Users/jonathanschen/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
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-23-23-165-24.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/jonathanschen/.ssh/known_hosts:8
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: Offering RSA public key: /Users/jonathanschen/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/jonathanschen/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
Jonathans-MacBook-Air-2:downloads jonathanschen$
I think your problem is in this line:
Warning: Identity file ec2-myportfolio.pem not accessible: No such file or directory.
Are you using the proper path reference and file name in your ssh command?

Resources