You will get the following error if you try to log in to an SSH server using a private key that has a very open permission.

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/shakir/.ssh/simplified-guide.pem
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/Users/shakir/.ssh/simplified-guide.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/Users/shakir/.ssh/simplified-guide.pem": bad permissions

The key will have the correct permission when created using ssh-keygen, but will change when being copied using tools that are not set to preserve the permission, which normally will use the permission as defined in the system's umask value.

To use the problematic private key, you will need to first change the permission of the key to a minimally accepted value.

Steps to change SSH private key permission in Linux:

  1. Get the location of private SSH key file.
  2. Launch terminal.
  3. Get the current permission of the private key(optional).
    $ ls -l .ssh/simplified-guide.pem
    -rwxr-xr-x@ 1 shakir  staff  1700 May 12  2021 .ssh/simplified-guide.pem
  4. Change the permission of the SSH private key to the acceptable level.
    $ chmod 600 .ssh/simplified-guide.pem

    The file must be owned by the user where the user has read and execute access, and is set to allow no access at all to user's group or other users.

  5. Try to connect again using the public key authentication method.
Discuss the article:

Comment anonymously. Login not required.