发新话题
打印

Ubuntu22.10之后的新版本sshd配置的变化

Ubuntu22.10之后的新版本sshd配置的变化

Ubuntu22.10之后的新版本sshd改成socket形式,netstat -nap查看端口对应的进程是init

光修改/etc/ssh/sshd_config中的“Port=xxx",再systemctl restart sshd/ssh 还不行,还要修改/lib/systemd/system/ssh.socket中的“ListenStream=xxx”

systemctl daemon-reload
systemctl restart ssh
netstat -tulpn


还原为之前的设置
systemctl disable --now ssh.socket
systemctl daemon-reload
systemctl enable --now ssh.service
systemctl restart ssh

参考:
https://askubuntu.com/questions/1439461/ssh-default-port-not-changing-ubuntu-22-10
https://askubuntu.com/questions/1479500/how-to-change-the-ssh-port-on-ubuntu-23-04

=========
另外 rsyslogd也需要编辑/etc/rsyslog.conf,注释掉多余的内容

#$FileOwner syslog
#$FileGroup adm
#$FileCreateMode 0640
#$DirCreateMode 0755
#$Umask 0022
#$PrivDropToUser syslog
#$PrivDropToGroup syslog

[ 本帖最后由 linda 于 2024-9-12 16:09 编辑 ]

TOP

发新话题