I've to write an small script to modify /etc/ssh/sshd_config
if this file is not matching with my checklist.
For examples I've to check below entries are matched, if not I need to replace with below entires:
Banner /etc/motd
GatewayPorts no
KeyRegenerationInterval 3600
LoginGraceTime 120
LogLevel INFO
PermitEmptyPasswords No
PermitRootLogin No
/etc/ssh/sshd_config
will be always like: One entry in a line like above or can it be any uses delimiter (Banner /etc/motd, GatewayPorts no
)? #
? 答案 0 :(得分:1)
给出了部分答案,但没有回答所有问题,所以:
sshd(8)
从/ etc / ssh / sshd_config(或者)中读取配置数据 在命令行上使用-f指定的文件)。 该文件包含 关键字 - 参数对,每行一个。 以“#”和开头的行 空行被解释为注释。参数可以是可选的 用双引号(“)括起来表示参数 包含空格。
KeyWord: value
而永远不会KeyWord1: value1, KeyWord2: value2
。 (该文件包含关键字 - 参数对,每行一个)sshd -T
来验证您的配置并查看其运行情况。答案 1 :(得分:0)
From the sshd_config(5)
man page (emphasis mine):
The file contains keyword-argument pairs, one per line. Lines starting with ‘#’ and empty lines are interpreted as comments.