SCP提示CONNECTION CLOSED BY HOST(IP)

兩臺linux服務器傳輸文件遇到如下問題:

scp /opt/data/xxx.log [email protected]:/opt/databak/
[email protected]'s password: 
Connection closed by 172.1.1.1
lost connection

經檢查防火牆已關閉,修改/etc/hosts.allow文件解決該問題:

在/etc/hosts.allow文件,加入 sshd:ALL,重啓sshd服務;

檢查/etc/hosts.deny文件,如果文件中有將 ALL: ALL 需要註釋掉,重啓sshd服務;

使用如下命令重啓ssh服務:

 

sh /etc/rc.d/init.d/ssh restart
sh /etc/rc.d/init.d/sshd restart
sh /etc/rc.d/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

或者在/etc/hosts.allow文件中增加IP白名單

#增加拷貝源IP

sshd : 172.1.1.1 

使用以上命令重啓sshd服務即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章