UNPROTECTED PRIVATE KEY FILE!” on Linux

If you might be getting this error then you almost certainly reset the permissions in your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s essential that these files not be writable by just anybody with a login to the box, so openssh will provide you with an error if you are attempting to make use of them.




The complete 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 repair this, you’ll have to reset the permissions back to default:

sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub


If you might be 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).


Because of this the permissions on that file are also set incorrectly, and could be adjusted with this:

sudo chmod 644 ~/.ssh/known_hosts


Finally, you might need to regulate the directory permissions as well:

sudo chmod 755 ~/.ssh


This could get you back up and running.



Nguồn: https://www.kpb-creations.net/en/unprotected-private-key-file-on-linux.html

Đăng nhận xét

Mới hơn Cũ hơn

Nhận xét Mới