问题原文
原帖链接 · Mojtaba Rezaeian · CC BY-SA 4.0
I have a very restricted user in my ssh server created with --no-create-home and --shell /bin/false.
I know I can define authorized_keys file in sshd_configs for the user's public key. But how can I allow public key authentication for this user without requiring to access any files on OS?
社区高分解答
原帖链接 · Ángel · CC BY-SA 4.0
diya has already explained that you could change to AuthorizedKeysCommand for retrieving the public key of a user.
However, it's probably easier for you to place the authorized_keys file somewhere else. For example you could set AuthorizedKeysFile /etc/ssh/authorizedkeys/%u and place the file that would have been at ~username/.ssh/authorized_keys at /etc/ssh/authorizedkeys/username instead.
And, if you want to change it only for this user (so other users still have their authorized_keys at ~/.ssh/), you could use
Match User username
AuthorizedKeysFile /some/path/username_authorized_keys
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
