在 sshd_config 中提到“AuthorizedKeysFile”时,我们可以使用通配符来拥有多个路径吗?

hitesh_noty

我希望每个授权密钥文件有一个公开。

例子:

在目录 %h/.ssh/

  • 对于人 A,单独的文件 A_authorized_key 包含 A 的公钥
  • 对于人 B,单独的文件 B_authorized_key 包含 B 的公钥

ls %h/.ssh/ 将给出:

  • A_authorized_key
  • B_authorized_key

我知道我们可以在authorized_keys文件中写入两个公钥,它会像魅力一样工作,但由于某种原因,我希望它在单独的文件中。

那么我们可以写AuthorizedKeysFile %h/.ssh/*吗?

我们能做到这一点吗?

牦牛

不可以AuthorizedKeysFile您不能在. 您可以使用多个文件,但不能使用通配符。

AuthorizedKeysFile

指定包含用于用户身份验证的公钥的文件...

但是您可以创建一个脚本,该脚本将选择所有这些键并将它们提供给ssh,它将以AuthorizedPrincipalsCommandand运行它AuthorizedKeysCommandUser

AuthorizedPrincipalsCommand /path/to/script
AuthorizedKeysCommandUser root

脚本看起来像这样:

#!/bin/bash
DIR="~${1}/.ssh/*"
cat `eval echo $DIR

但请注意,您的通配符也与用户的私钥相匹配,当您触摸这些密钥时,这绝不是一个好主意。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何配置sshd_config

来自分类Dev

sshd_config注释掉所有参数

来自分类Dev

我的sshd_config文件为空,这是正确的吗?

来自分类Dev

使用sshd_config限制root登录?

来自分类Dev

sshd_config用于拒绝登录尝试,但有例外

来自分类Dev

sshd_config中的意外匹配行为

来自分类Dev

匹配“ sshd_config”中的多个用户

来自分类Dev

为什么我对sshd_config文件所做的更改无法保存?

来自分类Dev

sshd_config中的Uselogin

来自分类Dev

更改sshd_config中的AuthorizedKeysFile不能解决带有加密主目录的公钥身份验证失败

来自分类Dev

有人可以在/ etc / ssh / sshd_config文件中解释“ PasswordAuthentication”吗?

来自分类Dev

是否可以在不禁用sshd_config中的StrictMode的情况下为一组用户使用通用AuthorizedKeysFile?

来自分类Dev

sshd_config中的`ServerAliveInterval`和`ClientAliveInterval`选项到底有什么作用?

来自分类Dev

后备sshd_config脚本

来自分类Dev

OS X忽略sshd_config

来自分类Dev

尽管sshd_config中的选项“ PermitRootLogin yes”仍然无法使用根ssh

来自分类Dev

试图了解和使用SSH。从sshd_config删除所有ssh密码会发生什么

来自分类Dev

编辑sshd_config时无法从sed获得所需的输出

来自分类Dev

即使/ etc / ssh / sshd_config中的“ PasswordAuthentication no”也可以通过SFTP使用密码身份验证

来自分类Dev

保留sshd_config设置

来自分类Dev

在哪里可以找到当前稳定的RHEL sshd_config?

来自分类Dev

匹配sshd_config中的用户放置

来自分类Dev

黑白sshd_config和sshd命令有什么区别?

来自分类Dev

使用 cloud init config 更改 /etc/ssh/sshd_config 中的默认值

来自分类Dev

Linux 中的 sshd_config 文件中可以提供的 AllowUsers 中的用户条目数是否有限制?

来自分类Dev

sshd_config 选项:`PermitTunnel` 与 `AllowTcpForwarding`

来自分类Dev

如何在 sshd_config 中没有 PubkeyAuthentication 时排除某人

来自分类Dev

使用 cloud init config 更改 /etc/ssh/sshd_config 中的默认值

来自分类Dev

使用 ansible playbook 修改 sshd_config 中的 AllowGroups

Related 相关文章

  1. 1

    如何配置sshd_config

  2. 2

    sshd_config注释掉所有参数

  3. 3

    我的sshd_config文件为空,这是正确的吗?

  4. 4

    使用sshd_config限制root登录?

  5. 5

    sshd_config用于拒绝登录尝试,但有例外

  6. 6

    sshd_config中的意外匹配行为

  7. 7

    匹配“ sshd_config”中的多个用户

  8. 8

    为什么我对sshd_config文件所做的更改无法保存?

  9. 9

    sshd_config中的Uselogin

  10. 10

    更改sshd_config中的AuthorizedKeysFile不能解决带有加密主目录的公钥身份验证失败

  11. 11

    有人可以在/ etc / ssh / sshd_config文件中解释“ PasswordAuthentication”吗?

  12. 12

    是否可以在不禁用sshd_config中的StrictMode的情况下为一组用户使用通用AuthorizedKeysFile?

  13. 13

    sshd_config中的`ServerAliveInterval`和`ClientAliveInterval`选项到底有什么作用?

  14. 14

    后备sshd_config脚本

  15. 15

    OS X忽略sshd_config

  16. 16

    尽管sshd_config中的选项“ PermitRootLogin yes”仍然无法使用根ssh

  17. 17

    试图了解和使用SSH。从sshd_config删除所有ssh密码会发生什么

  18. 18

    编辑sshd_config时无法从sed获得所需的输出

  19. 19

    即使/ etc / ssh / sshd_config中的“ PasswordAuthentication no”也可以通过SFTP使用密码身份验证

  20. 20

    保留sshd_config设置

  21. 21

    在哪里可以找到当前稳定的RHEL sshd_config?

  22. 22

    匹配sshd_config中的用户放置

  23. 23

    黑白sshd_config和sshd命令有什么区别?

  24. 24

    使用 cloud init config 更改 /etc/ssh/sshd_config 中的默认值

  25. 25

    Linux 中的 sshd_config 文件中可以提供的 AllowUsers 中的用户条目数是否有限制?

  26. 26

    sshd_config 选项:`PermitTunnel` 与 `AllowTcpForwarding`

  27. 27

    如何在 sshd_config 中没有 PubkeyAuthentication 时排除某人

  28. 28

    使用 cloud init config 更改 /etc/ssh/sshd_config 中的默认值

  29. 29

    使用 ansible playbook 修改 sshd_config 中的 AllowGroups

热门标签

归档