scp ssh: connect to host 192.168.6.129 port 22: Connection refused lost connection_重启

一、对方主机未安装ssh-server

1. 查看是否有sshd进程

ps -e | grep ssh

scp ssh: connect to host 192.168.6.129 port 22: Connection refused lost connection_linux_02

2. 安装openssh-server

sudo apt-get install openssh-server

3. 如果安装了,但是没有sshd进程,可以重启

/etc/init.d/ssh restart


二、如果之后,再提示Permission denied, please try again

scp ssh: connect to host 192.168.6.129 port 22: Connection refused lost connection_linux_03

1. 对方机器的root是否设置了密码


2. 对方ssh是否设置了允许root登录

vim /etc/ssh/sshd_config

将PermitRootLogin no / without-password 改为 PermitRootLogin yes,然后重启sshd服务。

scp ssh: connect to host 192.168.6.129 port 22: Connection refused lost connection_ssh_04


最终就成功了


scp ssh: connect to host 192.168.6.129 port 22: Connection refused lost connection_ssh_05