How to change the default position of ~/.ssh/authorized_keys

14,812

Solution 1

If you use an encrypted home directory you will need to change the location.

On the server, edit /etc/ssh/sshd_config to change the location and re-start the ssh server.

See http://bodhizazen.com/Tutorials/Ecryptfs#SSH for details

Solution 2

http://www.openssh.com/txt/release-5.9

* sshd_config(5)'s AuthorizedKeysFile now accepts multiple paths,
   separated by whitespace. The undocumented AuthorizedKeysFile2
   option is deprecated (though the default for AuthorizedKeysFile
   includes .ssh/authorized_keys2)

e.g.

AuthorizedKeysFile <path1> <path2> <pathN>
Share:
14,812

Related videos on Youtube

Bangyou
Author by

Bangyou

Updated on September 18, 2022

Comments

  • Bangyou
    Bangyou over 1 year

    My VM server is installed Ubuntu 12.04 and connected to a storage (not sure about the system of this storage). I have change my home directory to the storage. However this storage could be assessed by a domain group with write permission (I cannot change it).

    It could be dangerous if I put my keys where other people can view it. BTW: It seems the authorized_keys cannot be read from my new location ~/.ssh/authorized_keys (I still need to type my password every time). How could I change the ~/.ssh/authorized_keys to another place?

    Thanks for any advice. Please let me know if my question is not clear.

  • Merijn dk
    Merijn dk over 7 years
    Can you please expand your answer?