haole 大佬有话说 :
vultr,linode,ssh改端口后都出现connection refused?
本帖最后由 haole 于 2020-7-3 20:21 编辑
都是centos7
vi /etc/ssh/sshd_config
里面添加了port 12345
出于方便,我直接把防火墙永久关闭了。
但是putty连接ssh12345,出现network error: connection refused。
同样的方法,我在hostyun就没问题。
那vultr和linode,到底怎么改centos7的端口啊。毕竟不改端口频繁有人连挺耗费资源的。
ByteCat 大佬有话说 :
selinux 安全设置看看https://cdn.jsdelivr.net/gh/hishis/forum-master/public/images/patch.gif
loveqianool 大佬有话说 :
本帖最后由 loveqianool 于 2020-7-3 20:24 编辑
改了后要重启 sshd 服务。
sed -e "s/^#?Port.*/Port 1234/g"
-e "s/^#?PermitRootLogin.*/PermitRootLogin prohibit-password/g"
-e "s/^#?IgnoreUserKnownHosts.*/IgnoreUserKnownHosts yes/g"
-e "s/^#?PubkeyAuthentication.*/PubkeyAuthentication yes/g"
-e "s/^#?PasswordAuthentication.*/PasswordAuthentication no/g"
-e "s/^#?GSSAPIAuthentication.*/GSSAPIAuthentication no/g" -i /etc/ssh/sshd_config &&
grep -E ‘PubkeyAuthentication|PermitRootLogin|PasswordAuthentication|GSSAPIAuthentication|IgnoreUserKnownHosts|Port’ /etc/ssh/sshd_config &&
systemctl restart sshd
haole 大佬有话说 :
ByteCat 大佬有话说 : 2020-7-3 20:21
selinux 安全设置看看
我vultr选的centos7 without selinux
jac360 大佬有话说 :
设置错了把