Ssh – Cannot cd to .ssh

cd-commandpermission deniedssh

After adding new ssh key to .ssh/authorized_hosts I can no longer ssh to the machine without entering password.

What is even more funny is that the .ssh directory is suddenly inaccessible when I'm logged in via ssh (no direct console access):

pi@prodpi ~ $ ls -la
drw-------   2 pi   pi      4096 Mar 13  2015 .ssh

pi@prodpi ~ $ cd .ssh/
-bash: cd: .ssh/: Permission denied

pi@prodpi ~ $ ls .ssh/
ls: cannot access .ssh/authorized_keys: Permission denied
ls: cannot access .ssh/known_hosts: Permission denied
authorized_keys  known_hosts

pi@prodpi ~ $ sudo ls .ssh/
authorized_keys  known_hosts

The user is pi. What- if not directory permissions- could prevent me from accessing the folder as owner and potentially screw ssh login?

Best Answer

To enter a directory you have to set executable permission on it.

This should do it:

chmod u+x .ssh/

Related Question