兩臺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服務即可。