I would like to create a user account that can access web server files. I could set the home directory of this user to /var/www now, but the standard location for the authorized_keys file is in the user's home directory and I don't like those files lying around there. What would be the best way to store the keys file?
Asked
Active
Viewed 391 times
1 Answers
1
The authorized_keys file contains the public key(s). If you want to change that, per user, you could alter your /etc/ssh/sshd_config and add something like...
Match User sftpuser
AuthorizedKeysFile /path/to/ftpuser_public_key
I've never done this but I suspect the path to the file must be readable by the user. I also don't know if this is the best way, but I do share your OCD for files laying around. Good luck!

Vex Mage
- 86
- 4
-
By the way, and for posterity sake, you could combine a Match statement to match a Host and User to override things even further. For example one could Match User user, Host !10.0.0.* and override the path to the authorizedkeysfile to require a different ssh key depending on if you're coming from the LAN or the WAN. – Vex Mage Jul 30 '15 at 21:43