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:

  1. Create a suitable root-owned directory, e.g., /etc/ssh/keys, under which authorized keys are stored.
  2. Create a subdirectory under this directory for each user, and move each user's authorized_keys file to /etc/ssh/keys/<user>/authorized_keys.
  3. Finally, change set AuthorizedKeysFile /etc/ssh/keys/%u/authorized_keys in /etc/ssh/sshd_config.

source

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 :*(

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct