How do you move a Authorized_keys?
So I have an user that has a private key and public key. These keys work. However I wanted to change the home directory of this user to /var/www/html/example.com/
. The reason for it because I want to restrict this user from browsing trough the entire server. here is a YouTube video that I'm following link
By doing some research I found the following:
In principle, moving SSH keys to a root-owned location is easy:
- Create a suitable root-owned directory, e.g.,
/etc/ssh/keys
, under which authorized keys are stored.- Create a subdirectory under this directory for each user, and move each user's authorized_keys file to
/etc/ssh/keys/<user>/authorized_keys
.- Finally, change set AuthorizedKeysFile
/etc/ssh/keys/%u/authorized_keys
in/etc/ssh/sshd_config
.
However the responds I get from the server when trying to log in is:
Server refused our key
What could be the cause of this?
1 Reply
I wish I could delete this post…
It seems that I made a grammar mistake inside the /etc/ssh/sshd_config
I used &u
and not %u
. The font made them look the same :*(