After changing permissions to home/ec2-user of the main volume I can no longer SSH in even after changing...











up vote
2
down vote

favorite












AS the title mentions. I was dumb enough to change the permissions of home/ec2-user recursively to 777 after which I could not log in. I then detached the volume and then attached it to another instance and changed the permission to 700 recursively of that folder. Now when I try to connect to it using the following command I get the error



     ssh -v -i  ~/Amazon-fooDev/fooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com
OpenSSH_7.8p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/admin/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to ec2-34-212-108-144.us-west-2.compute.amazonaws.com port 22.
debug1: Connection established.
debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem type -1
debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.8
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-34-212-108-144.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
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:XJWnn7TLa5feJVY7kAOUJQGmWm8J3UNQ/MM+uQZa+Sk
debug1: Host 'ec2-34-212-108-144.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/admin/.ssh/known_hosts:1
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=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/admin/Amazon-fooDev/fooDev.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com: Permission denied (publickey).


Any suggestions on what I could do to fix this problem. I wasted an entire day trying to connect to that instance and get back to the state it was originally in. Any suggestions would be appreciated. Is 700 permission for home/ec2-user correct ? or should i change it to something else ? Do u think I might be looking in the wrong direction ?



Here are a list of some of the latest permissions



[root@ip-172-31-42-113 vol1]# chmod 600 home/ec2-user/.ssh/authorized_keys
[root@ip-172-31-42-113 vol1]# ls -l
total 120
dr-xr-xr-x 2 root root 4096 Nov 17 09:05 bin
dr-xr-xr-x 4 root root 4096 Nov 17 09:05 boot
drwxr-xr-x 2 root root 4096 Feb 28 2014 cgroup
drwxr-xr-x 2 root root 4096 Aug 11 01:27 dev
drwxr-xr-x 83 root root 4096 Nov 27 01:51 etc
drwx------ 3 root root 4096 Nov 17 05:10 home
dr-xr-xr-x 7 root root 4096 Nov 17 08:48 lib
dr-xr-xr-x 10 root root 12288 Nov 17 09:05 lib64
drwxr-xr-x 2 root root 4096 Aug 11 01:26 local
drwx------ 2 root root 16384 Aug 11 01:26 lost+found
drwxr-xr-x 2 root root 4096 Jan 6 2012 media
drwxr-xr-x 2 root root 4096 Jan 6 2012 mnt
drwxr-xr-x 3 root root 4096 Aug 11 01:26 opt
drwxr-xr-x 2 root root 4096 Aug 11 01:26 proc
dr-xr-x--- 5 root root 4096 Nov 26 12:00 root
drwxr-xr-x 3 root root 4096 Nov 17 05:10 run
dr-xr-xr-x 2 root root 12288 Nov 17 09:05 sbin
drwxr-xr-x 2 root root 4096 Jan 6 2012 selinux
drwxr-xr-x 2 root root 4096 Jan 6 2012 srv
drwxr-xr-x 2 root root 4096 Aug 11 01:26 sys
drwxrwxrwt 3 root root 4096 Nov 27 03:15 tmp
drwxr-xr-x 16 root root 4096 Nov 22 23:12 usr
drwxr-xr-x 20 root root 4096 Nov 17 08:31 var
[root@ip-172-31-42-113 vol1]# cd home/ec2-user/.ssh/
[root@ip-172-31-42-113 .ssh]# ls -l
total 4
-rw------- 1 ec2-user ec2-user 391 Nov 27 01:51 authorized_keys









share|improve this question




























    up vote
    2
    down vote

    favorite












    AS the title mentions. I was dumb enough to change the permissions of home/ec2-user recursively to 777 after which I could not log in. I then detached the volume and then attached it to another instance and changed the permission to 700 recursively of that folder. Now when I try to connect to it using the following command I get the error



         ssh -v -i  ~/Amazon-fooDev/fooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com
    OpenSSH_7.8p1, LibreSSL 2.7.3
    debug1: Reading configuration data /Users/admin/.ssh/config
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 48: Applying options for *
    debug1: Connecting to ec2-34-212-108-144.us-west-2.compute.amazonaws.com port 22.
    debug1: Connection established.
    debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem type -1
    debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_7.8
    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-34-212-108-144.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
    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:XJWnn7TLa5feJVY7kAOUJQGmWm8J3UNQ/MM+uQZa+Sk
    debug1: Host 'ec2-34-212-108-144.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
    debug1: Found key in /Users/admin/.ssh/known_hosts:1
    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=<rsa-sha2-256,rsa-sha2-512>
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Trying private key: /Users/admin/Amazon-fooDev/fooDev.pem
    debug1: Authentications that can continue: publickey
    debug1: No more authentication methods to try.
    ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com: Permission denied (publickey).


    Any suggestions on what I could do to fix this problem. I wasted an entire day trying to connect to that instance and get back to the state it was originally in. Any suggestions would be appreciated. Is 700 permission for home/ec2-user correct ? or should i change it to something else ? Do u think I might be looking in the wrong direction ?



    Here are a list of some of the latest permissions



    [root@ip-172-31-42-113 vol1]# chmod 600 home/ec2-user/.ssh/authorized_keys
    [root@ip-172-31-42-113 vol1]# ls -l
    total 120
    dr-xr-xr-x 2 root root 4096 Nov 17 09:05 bin
    dr-xr-xr-x 4 root root 4096 Nov 17 09:05 boot
    drwxr-xr-x 2 root root 4096 Feb 28 2014 cgroup
    drwxr-xr-x 2 root root 4096 Aug 11 01:27 dev
    drwxr-xr-x 83 root root 4096 Nov 27 01:51 etc
    drwx------ 3 root root 4096 Nov 17 05:10 home
    dr-xr-xr-x 7 root root 4096 Nov 17 08:48 lib
    dr-xr-xr-x 10 root root 12288 Nov 17 09:05 lib64
    drwxr-xr-x 2 root root 4096 Aug 11 01:26 local
    drwx------ 2 root root 16384 Aug 11 01:26 lost+found
    drwxr-xr-x 2 root root 4096 Jan 6 2012 media
    drwxr-xr-x 2 root root 4096 Jan 6 2012 mnt
    drwxr-xr-x 3 root root 4096 Aug 11 01:26 opt
    drwxr-xr-x 2 root root 4096 Aug 11 01:26 proc
    dr-xr-x--- 5 root root 4096 Nov 26 12:00 root
    drwxr-xr-x 3 root root 4096 Nov 17 05:10 run
    dr-xr-xr-x 2 root root 12288 Nov 17 09:05 sbin
    drwxr-xr-x 2 root root 4096 Jan 6 2012 selinux
    drwxr-xr-x 2 root root 4096 Jan 6 2012 srv
    drwxr-xr-x 2 root root 4096 Aug 11 01:26 sys
    drwxrwxrwt 3 root root 4096 Nov 27 03:15 tmp
    drwxr-xr-x 16 root root 4096 Nov 22 23:12 usr
    drwxr-xr-x 20 root root 4096 Nov 17 08:31 var
    [root@ip-172-31-42-113 vol1]# cd home/ec2-user/.ssh/
    [root@ip-172-31-42-113 .ssh]# ls -l
    total 4
    -rw------- 1 ec2-user ec2-user 391 Nov 27 01:51 authorized_keys









    share|improve this question


























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      AS the title mentions. I was dumb enough to change the permissions of home/ec2-user recursively to 777 after which I could not log in. I then detached the volume and then attached it to another instance and changed the permission to 700 recursively of that folder. Now when I try to connect to it using the following command I get the error



           ssh -v -i  ~/Amazon-fooDev/fooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com
      OpenSSH_7.8p1, LibreSSL 2.7.3
      debug1: Reading configuration data /Users/admin/.ssh/config
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 48: Applying options for *
      debug1: Connecting to ec2-34-212-108-144.us-west-2.compute.amazonaws.com port 22.
      debug1: Connection established.
      debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem type -1
      debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem-cert type -1
      debug1: Local version string SSH-2.0-OpenSSH_7.8
      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-34-212-108-144.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
      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:XJWnn7TLa5feJVY7kAOUJQGmWm8J3UNQ/MM+uQZa+Sk
      debug1: Host 'ec2-34-212-108-144.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
      debug1: Found key in /Users/admin/.ssh/known_hosts:1
      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=<rsa-sha2-256,rsa-sha2-512>
      debug1: SSH2_MSG_SERVICE_ACCEPT received
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Trying private key: /Users/admin/Amazon-fooDev/fooDev.pem
      debug1: Authentications that can continue: publickey
      debug1: No more authentication methods to try.
      ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com: Permission denied (publickey).


      Any suggestions on what I could do to fix this problem. I wasted an entire day trying to connect to that instance and get back to the state it was originally in. Any suggestions would be appreciated. Is 700 permission for home/ec2-user correct ? or should i change it to something else ? Do u think I might be looking in the wrong direction ?



      Here are a list of some of the latest permissions



      [root@ip-172-31-42-113 vol1]# chmod 600 home/ec2-user/.ssh/authorized_keys
      [root@ip-172-31-42-113 vol1]# ls -l
      total 120
      dr-xr-xr-x 2 root root 4096 Nov 17 09:05 bin
      dr-xr-xr-x 4 root root 4096 Nov 17 09:05 boot
      drwxr-xr-x 2 root root 4096 Feb 28 2014 cgroup
      drwxr-xr-x 2 root root 4096 Aug 11 01:27 dev
      drwxr-xr-x 83 root root 4096 Nov 27 01:51 etc
      drwx------ 3 root root 4096 Nov 17 05:10 home
      dr-xr-xr-x 7 root root 4096 Nov 17 08:48 lib
      dr-xr-xr-x 10 root root 12288 Nov 17 09:05 lib64
      drwxr-xr-x 2 root root 4096 Aug 11 01:26 local
      drwx------ 2 root root 16384 Aug 11 01:26 lost+found
      drwxr-xr-x 2 root root 4096 Jan 6 2012 media
      drwxr-xr-x 2 root root 4096 Jan 6 2012 mnt
      drwxr-xr-x 3 root root 4096 Aug 11 01:26 opt
      drwxr-xr-x 2 root root 4096 Aug 11 01:26 proc
      dr-xr-x--- 5 root root 4096 Nov 26 12:00 root
      drwxr-xr-x 3 root root 4096 Nov 17 05:10 run
      dr-xr-xr-x 2 root root 12288 Nov 17 09:05 sbin
      drwxr-xr-x 2 root root 4096 Jan 6 2012 selinux
      drwxr-xr-x 2 root root 4096 Jan 6 2012 srv
      drwxr-xr-x 2 root root 4096 Aug 11 01:26 sys
      drwxrwxrwt 3 root root 4096 Nov 27 03:15 tmp
      drwxr-xr-x 16 root root 4096 Nov 22 23:12 usr
      drwxr-xr-x 20 root root 4096 Nov 17 08:31 var
      [root@ip-172-31-42-113 vol1]# cd home/ec2-user/.ssh/
      [root@ip-172-31-42-113 .ssh]# ls -l
      total 4
      -rw------- 1 ec2-user ec2-user 391 Nov 27 01:51 authorized_keys









      share|improve this question















      AS the title mentions. I was dumb enough to change the permissions of home/ec2-user recursively to 777 after which I could not log in. I then detached the volume and then attached it to another instance and changed the permission to 700 recursively of that folder. Now when I try to connect to it using the following command I get the error



           ssh -v -i  ~/Amazon-fooDev/fooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com
      OpenSSH_7.8p1, LibreSSL 2.7.3
      debug1: Reading configuration data /Users/admin/.ssh/config
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 48: Applying options for *
      debug1: Connecting to ec2-34-212-108-144.us-west-2.compute.amazonaws.com port 22.
      debug1: Connection established.
      debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem type -1
      debug1: identity file /Users/admin/Amazon-fooDev/fooDev.pem-cert type -1
      debug1: Local version string SSH-2.0-OpenSSH_7.8
      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-34-212-108-144.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
      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:XJWnn7TLa5feJVY7kAOUJQGmWm8J3UNQ/MM+uQZa+Sk
      debug1: Host 'ec2-34-212-108-144.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
      debug1: Found key in /Users/admin/.ssh/known_hosts:1
      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=<rsa-sha2-256,rsa-sha2-512>
      debug1: SSH2_MSG_SERVICE_ACCEPT received
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Trying private key: /Users/admin/Amazon-fooDev/fooDev.pem
      debug1: Authentications that can continue: publickey
      debug1: No more authentication methods to try.
      ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com: Permission denied (publickey).


      Any suggestions on what I could do to fix this problem. I wasted an entire day trying to connect to that instance and get back to the state it was originally in. Any suggestions would be appreciated. Is 700 permission for home/ec2-user correct ? or should i change it to something else ? Do u think I might be looking in the wrong direction ?



      Here are a list of some of the latest permissions



      [root@ip-172-31-42-113 vol1]# chmod 600 home/ec2-user/.ssh/authorized_keys
      [root@ip-172-31-42-113 vol1]# ls -l
      total 120
      dr-xr-xr-x 2 root root 4096 Nov 17 09:05 bin
      dr-xr-xr-x 4 root root 4096 Nov 17 09:05 boot
      drwxr-xr-x 2 root root 4096 Feb 28 2014 cgroup
      drwxr-xr-x 2 root root 4096 Aug 11 01:27 dev
      drwxr-xr-x 83 root root 4096 Nov 27 01:51 etc
      drwx------ 3 root root 4096 Nov 17 05:10 home
      dr-xr-xr-x 7 root root 4096 Nov 17 08:48 lib
      dr-xr-xr-x 10 root root 12288 Nov 17 09:05 lib64
      drwxr-xr-x 2 root root 4096 Aug 11 01:26 local
      drwx------ 2 root root 16384 Aug 11 01:26 lost+found
      drwxr-xr-x 2 root root 4096 Jan 6 2012 media
      drwxr-xr-x 2 root root 4096 Jan 6 2012 mnt
      drwxr-xr-x 3 root root 4096 Aug 11 01:26 opt
      drwxr-xr-x 2 root root 4096 Aug 11 01:26 proc
      dr-xr-x--- 5 root root 4096 Nov 26 12:00 root
      drwxr-xr-x 3 root root 4096 Nov 17 05:10 run
      dr-xr-xr-x 2 root root 12288 Nov 17 09:05 sbin
      drwxr-xr-x 2 root root 4096 Jan 6 2012 selinux
      drwxr-xr-x 2 root root 4096 Jan 6 2012 srv
      drwxr-xr-x 2 root root 4096 Aug 11 01:26 sys
      drwxrwxrwt 3 root root 4096 Nov 27 03:15 tmp
      drwxr-xr-x 16 root root 4096 Nov 22 23:12 usr
      drwxr-xr-x 20 root root 4096 Nov 17 08:31 var
      [root@ip-172-31-42-113 vol1]# cd home/ec2-user/.ssh/
      [root@ip-172-31-42-113 .ssh]# ls -l
      total 4
      -rw------- 1 ec2-user ec2-user 391 Nov 27 01:51 authorized_keys






      amazon-web-services amazon-ec2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 27 at 3:30

























      asked Nov 27 at 2:06









      MistyD

      1235




      1235






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          SSH parameter -i expects that the next parameter is the key name.



          In your case -iv tells ssh to read the key from file v - not quite what you wanted :) The flow-on effect is that the next parameter (the key name) is deemed to be the host name, which it obviously can't resolve.



          This will work:



          ssh -v -i ~/Amazon-Permission/FooDev.pem ec2-user@ec2-...


          Update after your update :)



          If you did recursive chmod 700 it changed the authorized_keys mode too.
          Mount the volume back to your little "helper" instance and do:



          chmod 600 home/ec2-user/.ssh/authorized_keys


          Update 2



          Your home/ must be mode 755 and not 700. Otherwise ssh can't check open the file as ec2-user.



          chmod 755 home
          chmod 700 home/ec2-user home/ec2-user/.ssh
          chmod 600 home/ec2-user/.ssh/authorized_keys


          Hope that helps :)






          share|improve this answer























          • Thanks I updated my post
            – MistyD
            Nov 27 at 2:42










          • @MistyD now you're missing -i ...
            – MLu
            Nov 27 at 2:43










          • sorry. I am so terrible at this DevOps stuff
            – MistyD
            Nov 27 at 2:45










          • @MistyD are you 100% sure it's the correct key?
            – MLu
            Nov 27 at 2:46






          • 1




            @MistyD Glad to hear that :)
            – MLu
            Nov 27 at 4:03


















          up vote
          3
          down vote













          First, fix the syntax error. You say you used:



          ssh -iv ~/Amazon-Permission/FooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com


          This tries to load an ssh private key named v, which is not what you want. You want the ssh private key named ~/Amazon-Permission/FooDev.pem. Remove the stray v that got in there somehow.






          share|improve this answer





















          • Yes. I realized that and I removed it
            – MistyD
            Nov 27 at 2:32










          • I just updated my post. I removed the error and put in more details
            – MistyD
            Nov 27 at 2:40











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f941738%2fafter-changing-permissions-to-home-ec2-user-of-the-main-volume-i-can-no-longer-s%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote



          accepted










          SSH parameter -i expects that the next parameter is the key name.



          In your case -iv tells ssh to read the key from file v - not quite what you wanted :) The flow-on effect is that the next parameter (the key name) is deemed to be the host name, which it obviously can't resolve.



          This will work:



          ssh -v -i ~/Amazon-Permission/FooDev.pem ec2-user@ec2-...


          Update after your update :)



          If you did recursive chmod 700 it changed the authorized_keys mode too.
          Mount the volume back to your little "helper" instance and do:



          chmod 600 home/ec2-user/.ssh/authorized_keys


          Update 2



          Your home/ must be mode 755 and not 700. Otherwise ssh can't check open the file as ec2-user.



          chmod 755 home
          chmod 700 home/ec2-user home/ec2-user/.ssh
          chmod 600 home/ec2-user/.ssh/authorized_keys


          Hope that helps :)






          share|improve this answer























          • Thanks I updated my post
            – MistyD
            Nov 27 at 2:42










          • @MistyD now you're missing -i ...
            – MLu
            Nov 27 at 2:43










          • sorry. I am so terrible at this DevOps stuff
            – MistyD
            Nov 27 at 2:45










          • @MistyD are you 100% sure it's the correct key?
            – MLu
            Nov 27 at 2:46






          • 1




            @MistyD Glad to hear that :)
            – MLu
            Nov 27 at 4:03















          up vote
          5
          down vote



          accepted










          SSH parameter -i expects that the next parameter is the key name.



          In your case -iv tells ssh to read the key from file v - not quite what you wanted :) The flow-on effect is that the next parameter (the key name) is deemed to be the host name, which it obviously can't resolve.



          This will work:



          ssh -v -i ~/Amazon-Permission/FooDev.pem ec2-user@ec2-...


          Update after your update :)



          If you did recursive chmod 700 it changed the authorized_keys mode too.
          Mount the volume back to your little "helper" instance and do:



          chmod 600 home/ec2-user/.ssh/authorized_keys


          Update 2



          Your home/ must be mode 755 and not 700. Otherwise ssh can't check open the file as ec2-user.



          chmod 755 home
          chmod 700 home/ec2-user home/ec2-user/.ssh
          chmod 600 home/ec2-user/.ssh/authorized_keys


          Hope that helps :)






          share|improve this answer























          • Thanks I updated my post
            – MistyD
            Nov 27 at 2:42










          • @MistyD now you're missing -i ...
            – MLu
            Nov 27 at 2:43










          • sorry. I am so terrible at this DevOps stuff
            – MistyD
            Nov 27 at 2:45










          • @MistyD are you 100% sure it's the correct key?
            – MLu
            Nov 27 at 2:46






          • 1




            @MistyD Glad to hear that :)
            – MLu
            Nov 27 at 4:03













          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          SSH parameter -i expects that the next parameter is the key name.



          In your case -iv tells ssh to read the key from file v - not quite what you wanted :) The flow-on effect is that the next parameter (the key name) is deemed to be the host name, which it obviously can't resolve.



          This will work:



          ssh -v -i ~/Amazon-Permission/FooDev.pem ec2-user@ec2-...


          Update after your update :)



          If you did recursive chmod 700 it changed the authorized_keys mode too.
          Mount the volume back to your little "helper" instance and do:



          chmod 600 home/ec2-user/.ssh/authorized_keys


          Update 2



          Your home/ must be mode 755 and not 700. Otherwise ssh can't check open the file as ec2-user.



          chmod 755 home
          chmod 700 home/ec2-user home/ec2-user/.ssh
          chmod 600 home/ec2-user/.ssh/authorized_keys


          Hope that helps :)






          share|improve this answer














          SSH parameter -i expects that the next parameter is the key name.



          In your case -iv tells ssh to read the key from file v - not quite what you wanted :) The flow-on effect is that the next parameter (the key name) is deemed to be the host name, which it obviously can't resolve.



          This will work:



          ssh -v -i ~/Amazon-Permission/FooDev.pem ec2-user@ec2-...


          Update after your update :)



          If you did recursive chmod 700 it changed the authorized_keys mode too.
          Mount the volume back to your little "helper" instance and do:



          chmod 600 home/ec2-user/.ssh/authorized_keys


          Update 2



          Your home/ must be mode 755 and not 700. Otherwise ssh can't check open the file as ec2-user.



          chmod 755 home
          chmod 700 home/ec2-user home/ec2-user/.ssh
          chmod 600 home/ec2-user/.ssh/authorized_keys


          Hope that helps :)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 27 at 3:35

























          answered Nov 27 at 2:41









          MLu

          5,32711634




          5,32711634












          • Thanks I updated my post
            – MistyD
            Nov 27 at 2:42










          • @MistyD now you're missing -i ...
            – MLu
            Nov 27 at 2:43










          • sorry. I am so terrible at this DevOps stuff
            – MistyD
            Nov 27 at 2:45










          • @MistyD are you 100% sure it's the correct key?
            – MLu
            Nov 27 at 2:46






          • 1




            @MistyD Glad to hear that :)
            – MLu
            Nov 27 at 4:03


















          • Thanks I updated my post
            – MistyD
            Nov 27 at 2:42










          • @MistyD now you're missing -i ...
            – MLu
            Nov 27 at 2:43










          • sorry. I am so terrible at this DevOps stuff
            – MistyD
            Nov 27 at 2:45










          • @MistyD are you 100% sure it's the correct key?
            – MLu
            Nov 27 at 2:46






          • 1




            @MistyD Glad to hear that :)
            – MLu
            Nov 27 at 4:03
















          Thanks I updated my post
          – MistyD
          Nov 27 at 2:42




          Thanks I updated my post
          – MistyD
          Nov 27 at 2:42












          @MistyD now you're missing -i ...
          – MLu
          Nov 27 at 2:43




          @MistyD now you're missing -i ...
          – MLu
          Nov 27 at 2:43












          sorry. I am so terrible at this DevOps stuff
          – MistyD
          Nov 27 at 2:45




          sorry. I am so terrible at this DevOps stuff
          – MistyD
          Nov 27 at 2:45












          @MistyD are you 100% sure it's the correct key?
          – MLu
          Nov 27 at 2:46




          @MistyD are you 100% sure it's the correct key?
          – MLu
          Nov 27 at 2:46




          1




          1




          @MistyD Glad to hear that :)
          – MLu
          Nov 27 at 4:03




          @MistyD Glad to hear that :)
          – MLu
          Nov 27 at 4:03












          up vote
          3
          down vote













          First, fix the syntax error. You say you used:



          ssh -iv ~/Amazon-Permission/FooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com


          This tries to load an ssh private key named v, which is not what you want. You want the ssh private key named ~/Amazon-Permission/FooDev.pem. Remove the stray v that got in there somehow.






          share|improve this answer





















          • Yes. I realized that and I removed it
            – MistyD
            Nov 27 at 2:32










          • I just updated my post. I removed the error and put in more details
            – MistyD
            Nov 27 at 2:40















          up vote
          3
          down vote













          First, fix the syntax error. You say you used:



          ssh -iv ~/Amazon-Permission/FooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com


          This tries to load an ssh private key named v, which is not what you want. You want the ssh private key named ~/Amazon-Permission/FooDev.pem. Remove the stray v that got in there somehow.






          share|improve this answer





















          • Yes. I realized that and I removed it
            – MistyD
            Nov 27 at 2:32










          • I just updated my post. I removed the error and put in more details
            – MistyD
            Nov 27 at 2:40













          up vote
          3
          down vote










          up vote
          3
          down vote









          First, fix the syntax error. You say you used:



          ssh -iv ~/Amazon-Permission/FooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com


          This tries to load an ssh private key named v, which is not what you want. You want the ssh private key named ~/Amazon-Permission/FooDev.pem. Remove the stray v that got in there somehow.






          share|improve this answer












          First, fix the syntax error. You say you used:



          ssh -iv ~/Amazon-Permission/FooDev.pem ec2-user@ec2-34-212-108-144.us-west-2.compute.amazonaws.com


          This tries to load an ssh private key named v, which is not what you want. You want the ssh private key named ~/Amazon-Permission/FooDev.pem. Remove the stray v that got in there somehow.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 27 at 2:31









          Michael Hampton

          163k26303615




          163k26303615












          • Yes. I realized that and I removed it
            – MistyD
            Nov 27 at 2:32










          • I just updated my post. I removed the error and put in more details
            – MistyD
            Nov 27 at 2:40


















          • Yes. I realized that and I removed it
            – MistyD
            Nov 27 at 2:32










          • I just updated my post. I removed the error and put in more details
            – MistyD
            Nov 27 at 2:40
















          Yes. I realized that and I removed it
          – MistyD
          Nov 27 at 2:32




          Yes. I realized that and I removed it
          – MistyD
          Nov 27 at 2:32












          I just updated my post. I removed the error and put in more details
          – MistyD
          Nov 27 at 2:40




          I just updated my post. I removed the error and put in more details
          – MistyD
          Nov 27 at 2:40


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f941738%2fafter-changing-permissions-to-home-ec2-user-of-the-main-volume-i-can-no-longer-s%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents