关于连接linux被拒

一、scp被拒

 在服务器A命令行使用scp往服务器B传输,如:

scp -i id_rsa_125 file1 user01@IP:/home
#ssh_exchange_identification: read: Connection reset by peer
#lost connection

 出现这样的报错信息,查看/etc/hosts.allow和/etc/hosts.deny文件,一个IP请求连入,linux的检查策略是先看/etc/hosts.allow中是否允许,如果允许直接放行;如果没有,则再看/etc/hosts.deny中是否禁止,如果禁止那么就禁止连入

vi /etc/hosts.allow

 格式按照sshd:IP地址填写,也就是往B服务器上传输文件,B服务器的/etc/hosts.allow中要存在A的IP地址。

vi /etc/hosts.deny
#填写sshd:all

 所以需要查看服务器B的hosts.allow是否允许,hosts.deny是否禁止连接,allow和deny文件修改后

service sshd restart

  

原文地址:https://www.cnblogs.com/always-fight/p/9019126.html