Skip to content

Instantly share code, notes, and snippets.

@avidmaulanas
Last active March 20, 2017 04:02
Show Gist options
  • Select an option

  • Save avidmaulanas/6c3ad1b64e781eaf1d5e08892eb6307f to your computer and use it in GitHub Desktop.

Select an option

Save avidmaulanas/6c3ad1b64e781eaf1d5e08892eb6307f to your computer and use it in GitHub Desktop.

Revisions

  1. avidmaulanas revised this gist Mar 20, 2017. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions fix_warning_ssh
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,9 @@ This private key will be ignored.
    bad permissions: ignore key: /home/geek/.ssh/id_rsa

    To fix this, you'll need to reset the permissions back to default:
    ```bash
    sudo chmod 600 ~/.ssh/id_rsa
    sudo chmod 600 ~/.ssh/id_rsa.pub
    ```

    If you are getting another error:

    Are you sure you want to continue connecting (yes/no)? yes
  2. avidmaulanas revised this gist Mar 20, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion fix_warning_ssh
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,12 @@ Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open.
    It is recommended that your private key files are NOT accessible by others.
    This private key will be ignored.
    bad permissions: ignore key: /home/geek/.ssh/id_rsa
    To fix this, you’ll need to reset the permissions back to default:

    To fix this, you'll need to reset the permissions back to default:
    ```bash
    sudo chmod 600 ~/.ssh/id_rsa
    sudo chmod 600 ~/.ssh/id_rsa.pub
    ```
    If you are getting another error:

    Are you sure you want to continue connecting (yes/no)? yes
  3. avidmaulanas created this gist Mar 20, 2017.
    27 changes: 27 additions & 0 deletions fix_warning_ssh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux
    If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s very important that these files not be writable by just anybody with a login to the box, so openssh will give you an error if you try to use them.

    The full error message:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ WARNING: UNPROTECTED PRIVATE KEY FILE! @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open.
    It is recommended that your private key files are NOT accessible by others.
    This private key will be ignored.
    bad permissions: ignore key: /home/geek/.ssh/id_rsa
    To fix this, you’ll need to reset the permissions back to default:

    sudo chmod 600 ~/.ssh/id_rsa
    sudo chmod 600 ~/.ssh/id_rsa.pub
    If you are getting another error:

    Are you sure you want to continue connecting (yes/no)? yes
    Failed to add the host to the list of known hosts (/home/geek/.ssh/known_hosts).
    This means that the permissions on that file are also set incorrectly, and can be adjusted with this:

    sudo chmod 644 ~/.ssh/known_hosts
    Finally, you may need to adjust the directory permissions as well:

    sudo chmod 755 ~/.ssh
    This should get you back up and running.