SSHD 配置修改记录

日期:2026-06-16

修改目标

修改文件

/etc/ssh/sshd_config

修改内容:

- #Port 22
+ Port 3223

- PasswordAuthentication yes
+ PasswordAuthentication no

/etc/ssh/sshd_config.d/50-cloud-init.conf

该 Include 文件中存在密码登录配置,为避免覆盖主配置,同步修改:

- PasswordAuthentication yes
+ PasswordAuthentication no

校验

执行:

sshd -t

结果:无输出,表示配置语法校验通过。

生效方式

执行其一:

systemctl reload ssh

或:

systemctl reload sshd