-2

I have a EC2 Instance. My server is set up like this:

var/www/html / emmetarries, emmetphotoand emmetphotodev. I changed the permissions for emmetphoto ($sudo chmod 777 /var/www/html/emmetphoto).


I now can't upload files with SCP. I could before. My SCP command hasn't changed.

I rm -red, emmetphoto, it still doesn't work.

I tried running:

sudo chmod -R 755 /var/www/html

sudo chown -R apache:apache /var/www/html

sudo chown -R ec2-user:ec2-user /var/www/html

Doesn't work. I've been Googling for over a hour, nothing is working.


I've tried running SCP with -v, and i got this:

Executing: program /usr/bin/ssh host ec2-52-37-149-108.us-west-2.compute.amazonaws.com, user ec2-user, command scp -v -r -p -t /var/www/html/
OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Connecting to ec2-52-37-149-108.us-west-2.compute.amazonaws.com [52.37.149.108] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emmet/Desktop/test.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emmet/Desktop/test.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to ec2-52-37-149-108.us-west-2.compute.amazonaws.com:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
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:iCfVNRD/rr7Y92/R/yi+pFmXF9mNFzZU7FaDlRa64Qk
debug1: Host 'ec2-52-37-149-108.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/emmet/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/emmet/Desktop/test.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection

I will be happy to run whatever command. I really need this fixed.

If you need more info, comment!

I thank you from the bottom of my heart!

Emmet


EDIT 1:

The command I'm using is:

scp -i /Users/emmet/Desktop/test.pem -rp /Users/emmet/Desktop/emmetphoto ec2-user@ec2-52-37-149-108.us-west-2.compute.amazonaws.com:/var/www/html/


EDIT 2:

Error Log says:

[Thu Feb 16 03:50:01.351745 2017] [mpm_prefork:notice] [pid 30322] AH00173: SIGHUP received.  Attempting to restart
[Thu Feb 16 03:50:01.406025 2017] [auth_digest:notice] [pid 30322] AH01757: generating secret for digest authentication ...
[Thu Feb 16 03:50:01.406609 2017] [lbmethod_heartbeat:notice] [pid 30322] AH02282: No slotmem from mod_heartmonitor
[Thu Feb 16 03:50:01.429869 2017] [mpm_prefork:notice] [pid 30322] AH00163: Apache/2.4.25 (Amazon) PHP/5.6.29 configured -- resuming normal operations
[Thu Feb 16 03:50:01.429889 2017] [core:notice] [pid 30322] AH00094: Command line: '/usr/sbin/httpd'
rm: cannot remove '/var/www/html/emmetphoto/kings-beach-womens-march/index.php': Permission denied
rm: cannot remove '/var/www/html/emmetphoto/about/index.php': Permission denied
rm: cannot remove '/var/www/html/emmetphoto/nature/index.php': Permission denied
rm: cannot remove '/var/www/html/emmetphoto/nature/index.php': Permission denied
rm: cannot remove '/var/www/html/emmetphoto/nature/index.php': Permission denied
rm: cannot remove '/var/www/html/emmetphoto/kings-beach-womens-march/index.php': Permission denied
[Thu Feb 16 06:51:54.465527 2017] [mpm_prefork:notice] [pid 30322] AH00169: caught SIGTERM, shutting down
[Thu Feb 16 06:51:54.580369 2017] [suexec:notice] [pid 3275] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Feb 16 06:51:54.604880 2017] [auth_digest:notice] [pid 3276] AH01757: generating secret for digest authentication ...
[Thu Feb 16 06:51:54.605639 2017] [lbmethod_heartbeat:notice] [pid 3276] AH02282: No slotmem from mod_heartmonitor
[Thu Feb 16 06:51:54.626199 2017] [mpm_prefork:notice] [pid 3276] AH00163: Apache/2.4.25 (Amazon) PHP/5.6.29 configured -- resuming normal operations
[Thu Feb 16 06:51:54.626217 2017] [core:notice] [pid 3276] AH00094: Command line: '/usr/sbin/httpd'
[Thu Feb 16 07:29:50.659829 2017] [mpm_prefork:notice] [pid 3276] AH00169: caught SIGTERM, shutting down
[Thu Feb 16 07:29:50.764740 2017] [suexec:notice] [pid 3515] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Feb 16 07:29:50.789254 2017] [auth_digest:notice] [pid 3516] AH01757: generating secret for digest authentication ...
[Thu Feb 16 07:29:50.789831 2017] [lbmethod_heartbeat:notice] [pid 3516] AH02282: No slotmem from mod_heartmonitor
[Thu Feb 16 07:29:50.810599 2017] [mpm_prefork:notice] [pid 3516] AH00163: Apache/2.4.25 (Amazon) PHP/5.6.29 configured -- resuming normal operations
[Thu Feb 16 07:29:50.810618 2017] [core:notice] [pid 3516] AH00094: Command line: '/usr/sbin/httpd'

EDIT 3:

From secure log.

There's more before this. I reached the 30000 char limit. :)

Feb 16 07:33:24 ip-172-31-19-149 sshd[3568]: input_userauth_request: invalid user haldaemon [preauth]
Feb 16 07:33:24 ip-172-31-19-149 sshd[3568]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:33:26 ip-172-31-19-149 sshd[3571]: reverse mapping checking getaddrinfo for 71-83-110-240.dhcp.reno.nv.charter.com [71.83.110.240] failed - POSSIBLE BREAK-IN ATTEMPT!
Feb 16 07:33:27 ip-172-31-19-149 sshd[3571]: Authentication refused: bad ownership or modes for file /home/ec2-user/.ssh/authorized_keys
Feb 16 07:33:27 ip-172-31-19-149 sshd[3571]: Connection closed by 71.83.110.240 [preauth]
Feb 16 07:35:38 ip-172-31-19-149 sudo: ec2-user : TTY=pts/0 ; PWD=/var/www/html ; USER=root ; COMMAND=/bin/bash
Feb 16 07:36:18 ip-172-31-19-149 sshd[3596]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:38:25 ip-172-31-19-149 sshd[3598]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:40:14 ip-172-31-19-149 sshd[3602]: Invalid user deploy from 187.19.48.6
Feb 16 07:40:14 ip-172-31-19-149 sshd[3602]: input_userauth_request: invalid user deploy [preauth]
Feb 16 07:40:14 ip-172-31-19-149 sshd[3602]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:42:21 ip-172-31-19-149 sshd[3604]: Invalid user poll from 187.19.48.6
Feb 16 07:42:21 ip-172-31-19-149 sshd[3604]: input_userauth_request: invalid user poll [preauth]
Feb 16 07:42:21 ip-172-31-19-149 sshd[3604]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:44:52 ip-172-31-19-149 sshd[3642]: Invalid user noreply from 187.19.48.6
Feb 16 07:44:52 ip-172-31-19-149 sshd[3642]: input_userauth_request: invalid user noreply [preauth]
Feb 16 07:44:52 ip-172-31-19-149 sshd[3642]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:47:41 ip-172-31-19-149 sshd[3645]: Invalid user ftpadmin from 187.19.48.6
Feb 16 07:47:41 ip-172-31-19-149 sshd[3645]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 07:47:41 ip-172-31-19-149 sshd[3645]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:50:34 ip-172-31-19-149 sshd[3648]: Invalid user ftpadmin from 187.19.48.6
Feb 16 07:50:34 ip-172-31-19-149 sshd[3648]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 07:50:34 ip-172-31-19-149 sshd[3648]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:53:27 ip-172-31-19-149 sshd[3651]: Invalid user ftpadmin from 187.19.48.6
Feb 16 07:53:27 ip-172-31-19-149 sshd[3651]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 07:53:27 ip-172-31-19-149 sshd[3651]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:56:09 ip-172-31-19-149 sshd[3654]: Invalid user ftpadmin from 187.19.48.6
Feb 16 07:56:09 ip-172-31-19-149 sshd[3654]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 07:56:09 ip-172-31-19-149 sshd[3654]: Connection closed by 187.19.48.6 [preauth]
Feb 16 07:59:02 ip-172-31-19-149 sshd[3656]: Invalid user ftpadmin from 187.19.48.6
Feb 16 07:59:02 ip-172-31-19-149 sshd[3656]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 07:59:02 ip-172-31-19-149 sshd[3656]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:01:54 ip-172-31-19-149 sshd[3670]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:01:54 ip-172-31-19-149 sshd[3670]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:01:54 ip-172-31-19-149 sshd[3670]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:03:21 ip-172-31-19-149 sshd[3672]: Bad protocol version identification 'CONNECT 45.33.54.195:80 HTTP/1.0' from 66.91.17.103 port 63011
Feb 16 08:03:22 ip-172-31-19-149 sshd[3673]: Did not receive identification string from 66.91.17.103
Feb 16 08:03:22 ip-172-31-19-149 sshd[3674]: Did not receive identification string from 66.91.17.103
Feb 16 08:03:22 ip-172-31-19-149 sshd[3675]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 66.91.17.103 port 63049
Feb 16 08:03:48 ip-172-31-19-149 sshd[3676]: Bad protocol version identification 'CONNECT 216.58.209.196:80 HTTP/1.0' from 86.106.16.69 port 64217
Feb 16 08:03:49 ip-172-31-19-149 sshd[3677]: Did not receive identification string from 86.106.16.69
Feb 16 08:03:49 ip-172-31-19-149 sshd[3678]: Did not receive identification string from 86.106.16.69
Feb 16 08:03:49 ip-172-31-19-149 sshd[3679]: Bad protocol version identification 'GET http://www.google.com/search?q=213.64.131.79%3A45554 HTTP/1.0' from 86.106.16.69 port 64982
Feb 16 08:04:48 ip-172-31-19-149 sshd[3680]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:04:48 ip-172-31-19-149 sshd[3680]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:04:48 ip-172-31-19-149 sshd[3680]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:07:02 ip-172-31-19-149 sshd[3684]: Bad protocol version identification 'CONNECT proxyjudge.us:80 HTTP/1.0' from 45.117.156.126 port 50258
Feb 16 08:07:03 ip-172-31-19-149 sshd[3685]: Did not receive identification string from 45.117.156.126
Feb 16 08:07:03 ip-172-31-19-149 sshd[3686]: Did not receive identification string from 45.117.156.126
Feb 16 08:07:03 ip-172-31-19-149 sshd[3687]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 45.117.156.126 port 50392
Feb 16 08:07:41 ip-172-31-19-149 sshd[3688]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:07:41 ip-172-31-19-149 sshd[3688]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:07:41 ip-172-31-19-149 sshd[3688]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:08:15 ip-172-31-19-149 sudo:     root : TTY=pts/0 ; PWD=/var/www/html ; USER=root ; COMMAND=/bin/chmod 755 /var/log/httpd
Feb 16 08:10:34 ip-172-31-19-149 sshd[3730]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:10:34 ip-172-31-19-149 sshd[3730]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:10:34 ip-172-31-19-149 sshd[3730]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:13:29 ip-172-31-19-149 sshd[3732]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:13:29 ip-172-31-19-149 sshd[3732]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:13:29 ip-172-31-19-149 sshd[3732]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:16:10 ip-172-31-19-149 sshd[3735]: Bad protocol version identification 'CONNECT 213.180.204.62:443 HTTP/1.0' from 91.186.8.91 port 51148
Feb 16 08:16:10 ip-172-31-19-149 sshd[3736]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:11 ip-172-31-19-149 sshd[3737]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:11 ip-172-31-19-149 sshd[3738]: Bad protocol version identification 'GET https://www.yandex.com/search/?text=125.124.188.115%3A9999 HTTP/1.0' from 91.186.8.91 port 51205
Feb 16 08:16:11 ip-172-31-19-149 sshd[3739]: Bad protocol version identification 'CONNECT 204.79.197.200:80 HTTP/1.0' from 91.186.8.91 port 51246
Feb 16 08:16:12 ip-172-31-19-149 sshd[3742]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:12 ip-172-31-19-149 sshd[3743]: Bad protocol version identification 'GET http://www.bing.com/search?q=125.124.188.115%3A9999 HTTP/1.0' from 91.186.8.91 port 51303
Feb 16 08:16:12 ip-172-31-19-149 sshd[3744]: Bad protocol version identification 'CONNECT 45.33.54.195:80 HTTP/1.0' from 91.186.8.91 port 51325
Feb 16 08:16:12 ip-172-31-19-149 sshd[3745]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:13 ip-172-31-19-149 sshd[3746]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 91.186.8.91 port 51366
Feb 16 08:16:13 ip-172-31-19-149 sshd[3747]: Bad protocol version identification 'CONNECT 217.12.15.96:80 HTTP/1.0' from 91.186.8.91 port 51389
Feb 16 08:16:13 ip-172-31-19-149 sshd[3748]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:13 ip-172-31-19-149 sshd[3749]: Bad protocol version identification 'GET http://search.yahoo.com/search?p=125.124.188.115%3A9999 HTTP/1.0' from 91.186.8.91 port 51446
Feb 16 08:16:14 ip-172-31-19-149 sshd[3750]: Bad protocol version identification 'CONNECT 192.0.78.17:443 HTTP/1.0' from 91.186.8.91 port 51465
Feb 16 08:16:14 ip-172-31-19-149 sshd[3751]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:14 ip-172-31-19-149 sshd[3752]: Bad protocol version identification 'GET https://wordpress.com/ HTTP/1.0' from 91.186.8.91 port 51506
Feb 16 08:16:15 ip-172-31-19-149 sshd[3753]: Bad protocol version identification 'CONNECT 162.249.125.79:80 HTTP/1.0' from 91.186.8.91 port 51530
Feb 16 08:16:15 ip-172-31-19-149 sshd[3754]: Did not receive identification string from 91.186.8.91
Feb 16 08:16:15 ip-172-31-19-149 sshd[3756]: Bad protocol version identification 'GET http://www.sbjudge3.com/ip4.php HTTP/1.0' from 91.186.8.91 port 51587
Feb 16 08:16:22 ip-172-31-19-149 sshd[3740]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:16:22 ip-172-31-19-149 sshd[3740]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:16:22 ip-172-31-19-149 sshd[3740]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:18:51 ip-172-31-19-149 sshd[3757]: Invalid user ftpadmin from 187.19.48.6
Feb 16 08:18:51 ip-172-31-19-149 sshd[3757]: input_userauth_request: invalid user ftpadmin [preauth]
Feb 16 08:18:51 ip-172-31-19-149 sshd[3757]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:19:35 ip-172-31-19-149 sshd[3759]: Bad protocol version identification 'CONNECT 45.33.54.195:80 HTTP/1.0' from 139.167.3.169 port 56207
Feb 16 08:19:36 ip-172-31-19-149 sshd[3760]: Did not receive identification string from 139.167.3.169
Feb 16 08:19:37 ip-172-31-19-149 sshd[3761]: Did not receive identification string from 139.167.3.169
Feb 16 08:19:37 ip-172-31-19-149 sshd[3762]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 139.167.3.169 port 56226
Feb 16 08:20:01 ip-172-31-19-149 sshd[3763]: reverse mapping checking getaddrinfo for 71-83-110-240.dhcp.reno.nv.charter.com [71.83.110.240] failed - POSSIBLE BREAK-IN ATTEMPT!
Feb 16 08:20:01 ip-172-31-19-149 sshd[3763]: Authentication refused: bad ownership or modes for file /home/ec2-user/.ssh/authorized_keys
Feb 16 08:20:01 ip-172-31-19-149 sshd[3763]: Connection closed by 71.83.110.240 [preauth]
Feb 16 08:20:58 ip-172-31-19-149 sshd[3765]: reverse mapping checking getaddrinfo for 71-83-110-240.dhcp.reno.nv.charter.com [71.83.110.240] failed - POSSIBLE BREAK-IN ATTEMPT!
Feb 16 08:20:58 ip-172-31-19-149 sshd[3765]: Invalid user user from 71.83.110.240
Feb 16 08:20:58 ip-172-31-19-149 sshd[3765]: input_userauth_request: invalid user user [preauth]
Feb 16 08:20:58 ip-172-31-19-149 sshd[3765]: Connection closed by 71.83.110.240 [preauth]
Feb 16 08:21:12 ip-172-31-19-149 sshd[3767]: reverse mapping checking getaddrinfo for 71-83-110-240.dhcp.reno.nv.charter.com [71.83.110.240] failed - POSSIBLE BREAK-IN ATTEMPT!
Feb 16 08:21:12 ip-172-31-19-149 sshd[3767]: Invalid user user from 71.83.110.240
Feb 16 08:21:12 ip-172-31-19-149 sshd[3767]: input_userauth_request: invalid user user [preauth]
Feb 16 08:21:12 ip-172-31-19-149 sshd[3767]: Connection closed by 71.83.110.240 [preauth]
Feb 16 08:21:23 ip-172-31-19-149 sshd[3769]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:21:23 ip-172-31-19-149 sshd[3769]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:21:23 ip-172-31-19-149 sshd[3769]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:24:18 ip-172-31-19-149 sshd[3771]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:24:18 ip-172-31-19-149 sshd[3771]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:24:18 ip-172-31-19-149 sshd[3771]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:24:52 ip-172-31-19-149 sshd[3773]: Bad protocol version identification 'CONNECT 45.33.54.195:80 HTTP/1.0' from 62.210.111.46 port 8667
Feb 16 08:24:53 ip-172-31-19-149 sshd[3774]: Did not receive identification string from 62.210.111.46
Feb 16 08:24:53 ip-172-31-19-149 sshd[3775]: Did not receive identification string from 62.210.111.46
Feb 16 08:24:53 ip-172-31-19-149 sshd[3776]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 62.210.111.46 port 49535
Feb 16 08:27:12 ip-172-31-19-149 sshd[3779]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:27:12 ip-172-31-19-149 sshd[3779]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:27:12 ip-172-31-19-149 sshd[3779]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:30:07 ip-172-31-19-149 sshd[3783]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:30:07 ip-172-31-19-149 sshd[3783]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:30:07 ip-172-31-19-149 sshd[3783]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:33:02 ip-172-31-19-149 sshd[3786]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:33:02 ip-172-31-19-149 sshd[3786]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:33:02 ip-172-31-19-149 sshd[3786]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:35:25 ip-172-31-19-149 sshd[3788]: Bad protocol version identification 'CONNECT 45.33.54.195:80 HTTP/1.0' from 62.210.80.31 port 13404
Feb 16 08:35:26 ip-172-31-19-149 sshd[3789]: Did not receive identification string from 62.210.80.31
Feb 16 08:35:26 ip-172-31-19-149 sshd[3790]: Did not receive identification string from 62.210.80.31
Feb 16 08:35:26 ip-172-31-19-149 sshd[3791]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 62.210.80.31 port 34779
Feb 16 08:35:57 ip-172-31-19-149 sshd[3792]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:35:57 ip-172-31-19-149 sshd[3792]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:35:57 ip-172-31-19-149 sshd[3792]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:38:52 ip-172-31-19-149 sshd[3832]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:38:52 ip-172-31-19-149 sshd[3832]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:38:52 ip-172-31-19-149 sshd[3832]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:40:08 ip-172-31-19-149 sshd[3835]: reverse mapping checking getaddrinfo for 71-83-110-240.dhcp.reno.nv.charter.com [71.83.110.240] failed - POSSIBLE BREAK-IN ATTEMPT!
Feb 16 08:40:08 ip-172-31-19-149 sshd[3835]: Authentication refused: bad ownership or modes for file /home/ec2-user/.ssh/authorized_keys
Feb 16 08:40:08 ip-172-31-19-149 sshd[3835]: Connection closed by 71.83.110.240 [preauth]
Feb 16 08:41:46 ip-172-31-19-149 sshd[3837]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:41:46 ip-172-31-19-149 sshd[3837]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:41:46 ip-172-31-19-149 sshd[3837]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:44:41 ip-172-31-19-149 sshd[3840]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:44:41 ip-172-31-19-149 sshd[3840]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:44:41 ip-172-31-19-149 sshd[3840]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:46:42 ip-172-31-19-149 sshd[3845]: Received disconnect from 221.194.44.219: 11:  [preauth]
Feb 16 08:47:35 ip-172-31-19-149 sshd[3848]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:47:35 ip-172-31-19-149 sshd[3848]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:47:35 ip-172-31-19-149 sshd[3848]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:50:29 ip-172-31-19-149 sshd[3852]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:50:29 ip-172-31-19-149 sshd[3852]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:50:29 ip-172-31-19-149 sshd[3852]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:52:58 ip-172-31-19-149 sshd[3858]: Invalid user ftpuser from 187.19.48.6
Feb 16 08:52:58 ip-172-31-19-149 sshd[3858]: input_userauth_request: invalid user ftpuser [preauth]
Feb 16 08:52:58 ip-172-31-19-149 sshd[3858]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:55:27 ip-172-31-19-149 sshd[3862]: Bad protocol version identification 'CONNECT 45.33.54.195:80 HTTP/1.0' from 124.158.15.114 port 59612
Feb 16 08:55:28 ip-172-31-19-149 sshd[3863]: Did not receive identification string from 124.158.15.114
Feb 16 08:55:28 ip-172-31-19-149 sshd[3864]: Did not receive identification string from 124.158.15.114
Feb 16 08:55:29 ip-172-31-19-149 sshd[3865]: Bad protocol version identification 'GET http://proxyjudge.us/judge.php HTTP/1.0' from 124.158.15.114 port 59777
Feb 16 08:55:30 ip-172-31-19-149 sshd[3860]: Invalid user download from 187.19.48.6
Feb 16 08:55:30 ip-172-31-19-149 sshd[3860]: input_userauth_request: invalid user download [preauth]
Feb 16 08:55:30 ip-172-31-19-149 sshd[3860]: Connection closed by 187.19.48.6 [preauth]
Feb 16 08:56:44 ip-172-31-19-149 sshd[3866]: Disconnecting: Too many authentication failures for root [preauth]
Emmet Arries
  • 117
  • 1
  • 8

1 Answers1

4

Please read the output carefully. In my opinion the problem is not the folder but the login.

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/emmet/Desktop/test.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
**Permission denied (publickey)**.

I would say your key was refused. Please verify that

ssh -i /Users/emmet/Desktop/test.pem ec2-user@ec2-52-37-149-108.us-west-2.compute.amazonaws.com

is successful.

EDIT 1: Your permissions are not correct.

Feb 16 08:40:08 ip-172-31-19-149 sshd[3835]: Authentication refused: bad ownership or modes for file /home/ec2-user/.ssh/authorized_keys

Look here for more information.

cmoetzing
  • 156
  • 4
  • The SSH is not successful. I ran `chmod 400` on the `.pem`. and this was all working before I changed the file permissions on the server. – Emmet Arries Feb 16 '17 at 08:23
  • The .pem is stored on your client and scp finds it (see log). `debug1: Trying private key: /Users/emmet/Desktop/test.pem` Either this is the wrong certificate or it is not properly configured on the server. – cmoetzing Feb 16 '17 at 08:26
  • It is the right certificate, it's worked before. What do you mean by `not properly configured on the server`?? How could I have changed something? – Emmet Arries Feb 16 '17 at 08:29
  • Sorry, I made a mistake with the user in my SSH command. I corrected it to ec2-user (assuming you are using an Amazon AMI). How can you access the logs on the server if your SSH does not work? – cmoetzing Feb 16 '17 at 08:37
  • I got lucky, I'm still logged in. FYI, the command still returns `Permission denied (publickey).` – Emmet Arries Feb 16 '17 at 08:39
  • So then please verify the contents of `~/.ssh/authorized_keys` of your ec2-user (see [here](https://wiki.ubuntuusers.de/SSH/) for example). Your .pem needs to be in there. Also try to find your sshd logs. Probably in a file called syslog or something. – cmoetzing Feb 16 '17 at 08:43
  • In `/.ssh/authorized_keys` it says `no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ec2-user\" rather than the user \"root\".';echo;sleep 10" ssh-rsa`, then has a key. The key doesn't match `test.pem` on my machine. But after the key, it says `test`, the name of my `.pem`. I'll continue looking for the log. – Emmet Arries Feb 16 '17 at 08:55
  • I think I found the log, its really long, I will edit the question. – Emmet Arries Feb 16 '17 at 09:01
  • Added the `secure` log contents. My IP is 71.83.110.240, FYI. 1:09 AM here (same time zone as the EC2 instance). – Emmet Arries Feb 16 '17 at 09:09
  • Your certificates are usually a pair. One private and one public key. The public key should be on your server. The private key should be on you client. You can not directly compare the two keys. That is why you see a difference. I think in your log there is the root cause of your problem `Feb 16 08:40:08 ip-172-31-19-149 sshd[3835]: Authentication refused: bad ownership or modes for file /home/ec2-user/.ssh/authorized_keys` See [here](http://www.thelinuxdaily.com/2012/02/proper-authorized_keys-permissions-for-passwordless-ssh-access/). – cmoetzing Feb 16 '17 at 09:17
  • Do you want me to run `chmod 700 $HOME/.ssh chmod go-w $HOME $HOME/.ssh chmod 600 $HOME/.ssh/authorized_keys chown whoami $HOME/.ssh/authorized_keys`??? – Emmet Arries Feb 16 '17 at 09:19
  • This comment functions always submits on enter. Sorry. Just have a look at the link. It lists the correct permissions and commands. – cmoetzing Feb 16 '17 at 09:20
  • Am I supposed to replace `$HOME` with something?? – Emmet Arries Feb 16 '17 at 09:23
  • Your can replace it with */home/ec2-user/* or with *~/* – cmoetzing Feb 16 '17 at 09:25
  • I tried it, didn't seem to change anything. Wow. I really don't know what else to do. – Emmet Arries Feb 16 '17 at 09:29
  • Here's what I did: `chmod 700 /home/ec2-user/.ssh`,`chmod go-w /home/ec2-user /home/ec2-user/.ssh`,`chmod 600 /home/ec2-user/.ssh/authorized_keys` and `chown \`whoami\` /home/ec2-user/.ssh/authorized_keys` – Emmet Arries Feb 16 '17 at 09:30
  • Thank you so much for your help, I need to go to bed. I will get another EC2 Instance, I guess. – Emmet Arries Feb 16 '17 at 09:34