# cat /etc/ssh/sshd_config
Port 22
UsePAM yes
GatewayPorts no
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no
AcceptEnv LANG LC_*
AddressFamily any
TCPKeepAlive yes
X11Forwarding no
AllowTcpForwarding yes
ClientAliveInterval 60
Subsystem sftp /usr/lib/openssh/sftp-server
LogLevel INFO
PrintMotd no
Banner /etc/ssh/banner
@leileio #30 Ubuntu是支持这种配置方式的,可能哪里做错了

不过你直接改/etc/ssh/sshd_config里的端口也行
脚本?有什么话跟我的一百位随机密码+高端口说去吧
仅白名ip单登录足够了,我所有服务器密码都是123456,没被爆过
mark
然后弄好了以后开始安装各种来路不明的一键脚本
高位端口+复杂一些的密码,一般问题不大
@leileio #30 抱歉,是我疏忽了,Ubuntu24.04以后确实默认不再使用ssh.service了,我在文中修改一下,具体的变化可以参考这篇文章
https://dev.to/saishanmukkha/understanding-ssh-socket-based-activation-in-ubuntu-2404-28m
学习
装fail2ban就够了,失败三次自动拉黑ip
私钥带口令保护。