0

I generated a public/private rsa key pair to access the remote host via ssh without entering the password, everything worked fine till I made the user's folder hidden (Added . to name /home/.user). Now while connecting with SSH it can't find the public key to connect to and asks for a password.

ssh -i my_private_key [email protected]

Once I connect using the password it says:

Could not chdir to home directory /home/user: No such file or directory

P.S Did not change .sshd_config file. So how to fix it so it works with a hidden folder?

2 Answers 2

4

Edit /etc/passwd so it points to /home/.user also?

0
3

Users have their own home directories. When you login via ssh and you establish a successfull connection, the user's session starts in his own home directory. If the directory is missing, you get the error you have. Furthermore, if you moved the /home/user directory, it contains the .ssh directory which has your public key defined inside the authorized_keys file.

You could try and change the home directory to the "hidden" one using something like

usermod -d /home/.user user

This will make ssh read the public key, and start the session properly. But the "hidden" home directory would still be visible in /etc/passwd for example.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .