我想在/etc/ssh/sshd_config上做这个
Protocol 2
Ciphers aes256-ctr
PermitRootLogin no
X11Forwarding no
Match User joebob
X11Forwarding yes
AuthorizedKeysFile .ssh/authorized_keys
PermitEmptyPasswords no
RSAAuthentication no
RhostsRSAAuthentication no
IgnoreUserKnownHosts no问题是
Starting SSH daemon/etc/ssh/sshd_config line 40:
Directive 'IgnoreUserKnownHosts' is not allowed within a Match block但是,在match语句之后的第一个指令之后,似乎包含了许多指令,作为匹配的一部分?
如果我把它放在sshd_condig文件的末尾,那么我的Match语句就能工作。
我不想那样做。
有没有办法让这个match语句靠近文件的顶部,就在我的X11Forwarding no语句之后?
我有我关心的所有相关的ssh设置在文件的顶部,我希望我的匹配用户就在X11forwarding no之后,所以我知道它正在发生。如果把它放在文件的底部,我就忘了它。
我的目标是为每个人禁用X11Forwarding,但/etc/passwd中定义的本地用户帐户除外。
发布于 2020-03-19 16:55:34
如man sshd_config和Match部分所述:
在
Match关键字后面的行上只能使用关键字的子集。可用关键字有: AllowAgentForwarding、AllowTcpForwarding、Banner、ChrootDirectory、ForceCommand、GatewayPorts、GSSAPIAuthentication、HostbasedAuthentication、KbdInteractiveAuthentication、KerberosAuthentication、KerberosUseKuserok、MaxAuthTries、MaxSessions、PubkeyAuthentication、AuthorizedKeysCommand、AuthorizedKeysCommandRunAs、PasswordAuthentication、PermitEmptyPasswords、PermitOpen、PermitRootLogin、en19#、和
很好,正如您所看到的,IgnoreUserKnownHosts不能在Match部分。如果您有或将所有Match部件(如果有的话,一个或多个)移到第一个匹配的上面,或者将所有的配置部件(如果有的话,一个或多个)移到配置文件的末尾(这是建议的);否则,所有匹配后的配置都将覆盖全局配置,并仅应用于该用户(joebob)。
因此建议将所有的匹配移到配置文件的末尾。
发布于 2021-05-17 20:11:21
若要标记匹配块的结束,可以使用“匹配所有”。
Protocol 2
Ciphers aes256-ctr
PermitRootLogin no
X11Forwarding no
Match User joebob
X11Forwarding yes
Match all
AuthorizedKeysFile .ssh/authorized_keys
PermitEmptyPasswords no
RSAAuthentication no
RhostsRSAAuthentication no
IgnoreUserKnownHosts nohttps://unix.stackexchange.com/questions/573792
复制相似问题