我有一个服务器,我只使用openssh,openvpn和rabbitmq(这需要很多erlang的依赖)。
每当我重新启动我的服务器,我无法访问它了
端口22:拒绝连接
我必须从头安装所有东西。
我应该检查什么来避免这个问题?
端口22:拒绝连接
此消息表明防火墙正在主动阻止您的连接尝试,或者sshd不在该端口上侦听。
validation:
要在terminal中查看您的防火墙设置,请执行以下操作:
sudo iptables -L -n
你正在寻找这个
# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:ssh DROP all -- anywhere anywhere
如果没有设置端口ssh(22)规则,则尝试:
sudo iptables -I INPUT -p tcp -m tcp --dport 22 -j ACCEPT
将当前的iptables防火墙规则保存到名为/root/dsl.fw的文件中,键入:
# iptables-save > /root/dsl.fw
要恢复iptables规则,请input:
iptables-restore < /root/dsl.fw
要在Linux系统重新启动时自动恢复规则,请在/etc/rc.local文件中添加以下命令,请input:
# vi /etc/rc.local
追加行:
/sbin/iptables-restore < /root/dsl.fw
要检查哪些init服务正在运行,以及在哪个运行级别在terminal中尝试此操作
ls /etc/rc*.d
如果sshd没有列出,请在terminal中input:
update-rc.d ssh enable
试试(以root身份)
sudo apt-get install ssh
我没有在标准的Ubuntu桌面安装SSH服务器