/etc/ssh/sshd_config line 84: Unsupported option UsePAM Extra argument status.
时间: 2023-10-10 19:09:40 浏览: 69
这个错误信息是由于在SSH服务器的配置文件中 `UsePAM` 参数后面有多余的参数。
你需要打开 `/etc/ssh/sshd_config` 文件并找到 `UsePAM` 这一行。检查这一行后面是否有多余的参数,如果有则将其删除。如果不确定该如何修改可以将 `UsePAM` 这一行的参数修改为 `yes` 或者 `no` 来避免这个错误。然后保存文件并重启 SSH 服务即可。
相关问题
/etc/ssh/sshd_config: line 11: Bad configuration option: Include
This error message indicates that there is an incorrect configuration option in the /etc/ssh/sshd_config file on line 11. The option "Include" is not recognized as a valid configuration option in the sshd_config file.
To resolve this issue, you can either remove the "Include" option from line 11 or make sure that it is followed by a valid configuration file path.
For example, if you intended to include another configuration file, you can use the following syntax:
Include /etc/ssh/sshd_config.d/*.conf
This will include all the configuration files with .conf extension in the /etc/ssh/sshd_config.d/ directory.
After making the necessary changes to the sshd_config file, save it and restart the SSH service to apply the changes:
sudo systemctl restart sshd
逐条注释 ``` if grep -q "Protocol" /etc/ssh/sshd_config then sed -i '/Protocol/s/^#//' /etc/ssh/sshd_config sed -i "s/Protocol.*/Protocol 2/g" /etc/ssh/sshd_config else echo 'Protocol 2' >> /etc/ssh/sshd_config fi if grep -q "PrintMotd" /etc/ssh/sshd_config then sed -i '/PrintMotd/s/^#//' /etc/ssh/sshd_config sed -i "s/PrintMotd.*/PrintMotd yes/g" /etc/ssh/sshd_config else echo "PrintMotd yes" >> /etc/ssh/sshd_config fi service sshd restart systemctl restart sshd.service ```
这段脚本的作用是修改/etc/ssh/sshd_config文件中的SSH配置,并重新启动SSH服务。具体解释如下:
```shell
if grep -q "Protocol" /etc/ssh/sshd_config
then
sed -i '/Protocol/s/^#//' /etc/ssh/sshd_config
sed -i "s/Protocol.*/Protocol 2/g" /etc/ssh/sshd_config
else
echo 'Protocol 2' >> /etc/ssh/sshd_config
fi
```
- 检查/etc/ssh/sshd_config文件中是否存在"Protocol"这一行。
- 如果存在,则使用sed命令将该行的行首的注释符号#去掉,即取消注释。
- 然后使用sed命令将该行的值修改为"Protocol 2",即设置SSH协议版本为2。
- 如果不存在,则在文件末尾添加一行"Protocol 2"。
```shell
if grep -q "PrintMotd" /etc/ssh/sshd_config
then
sed -i '/PrintMotd/s/^#//' /etc/ssh/sshd_config
sed -i "s/PrintMotd.*/PrintMotd yes/g" /etc/ssh/sshd_config
else
echo "PrintMotd yes" >> /etc/ssh/sshd_config
fi
```
- 检查/etc/ssh/sshd_config文件中是否存在"PrintMotd"这一行。
- 如果存在,则使用sed命令将该行的行首的注释符号#去掉,即取消注释。
- 然后使用sed命令将该行的值修改为"PrintMotd yes",即启用SSH登录时显示欢迎信息。
- 如果不存在,则在文件末尾添加一行"PrintMotd yes"。
```shell
service sshd restart
systemctl restart sshd.service
```
- 重新启动SSH服务,使配置生效。这两行命令可能根据Linux发行版的不同而有所区别,用于重启SSH服务。