Happy Wednesday! It is time for another "From Problem to Polish" scenario.
We are looking at a common issue related to the learning objective Configure key-based authentication for SSH.
You have generated your SSH keys, copied the public key to the server, and expect passwordless login to work. Instead, the server ignores your key and keeps asking for a password. Something is not right.
You are setting up key-based SSH access for the user devops.
On the server, you manually created the directory /home/devops/.ssh and pasted your public key into the file authorized_keys.
However, when you try to connect, the server still prompts you for a password. To investigate, you run a verbose SSH command:
ssh -v devops@server
In the output you see the following message:
debug1: Authentication refused: bad ownership or modes for directory /home/devops/.ssh
The SSH daemon is very strict about file permissions and ownership. A small mistake here is enough to make it ignore your keys completely.
.ssh directory so that key-based authentication still works? Please answer in numeric form, for example 755 or 700.authorized_keys file inside that directory?Let us see who knows their strict modes. Share your answers and reasoning in the comments.
Ah ssh troubleshooting ! Also very popular Linux interview question / scenario :
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys chown -R <user>:<user> ~/.ssh
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.