mirror of
https://github.com/sahinakkaya/til.git
synced 2024-09-08 01:49:37 +02:00
TIL: Using private key to login to homeless user
This commit is contained in:
parent
f786fd27da
commit
bc1e1f2354
10
ssh/using-private-key-to-login-to-homeless-user.md
Normal file
10
ssh/using-private-key-to-login-to-homeless-user.md
Normal file
@ -0,0 +1,10 @@
|
||||
Authorized keys for the users stays in the home directory of the user by default. But not every user have home directory. If you want to use your keys to login as a user which does not have home directory, you can do this:
|
||||
|
||||
Assuming the name of the user is `git`:
|
||||
- create `/etc/ssh/authorized_keys_git` and put your key there
|
||||
- add the following in `/etc/ssh/sshd_config`:
|
||||
```bash
|
||||
Match User git
|
||||
AuthorizedKeysFile /etc/ssh/authorized_keys_%u
|
||||
```
|
||||
and restart sshd.
|
Loading…
Reference in New Issue
Block a user