scp出现ssh port 22: Connection refused 问题解决具体步骤

Posted 再见理想

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scp出现ssh port 22: Connection refused 问题解决具体步骤相关的知识,希望对你有一定的参考价值。

[root(0)@sys11 09:20:29 /home/work/Code_release/bj]# scp ./release.sh  [email protected]:/Users/a2014102/Downloads
ssh: connect to host 192.168.161.151 port 22: Connection refused
lost connection

 

 

Solution: 
One possible reason is that because the ssh server daemon, or sshd, is not loaded and running on localhost, so any attempt to ssh connect to localhost would fail. I check to see whether ssh and sshd are running by typing the following command:

 

 

  1. $ ps aux | grep ssh  

  2. # Result: bunch of lines, but none of them is about "sshd", only one line is about "ssh"  

 

Result is, I only see ssh running, but not sshd. So I know ssh server daemon is probably not started yet.

First, I verify that I have installed the package “openssh-server” on my fedora box.

Then I check the status of sshd service:

 

You may not have OpenSSH completely installed. Type this in terminal:

 

 

  1. sudo apt-get install openssh-client  

  2. sudo apt-get install openssh-server  

 

Another problem that you could have is that your firewall could be blocking the ssh connection. I use Firewall Configuration to manage my ports and firewall.

 

to restart it type

 

 

  1. sudo /etc/init.d/ssh restart  

 

to stop it type

 

  1. sudo /etc/init.d/ssh stop  

 

to start it type

 

 

    1. sudo /etc/init.d/ssh start  

以上是关于scp出现ssh port 22: Connection refused 问题解决具体步骤的主要内容,如果未能解决你的问题,请参考以下文章

linux(18)-解决本机ssh远程登录失败的问题 ssh: connect to host 192.168.1.3 port 22: Connection refused

服务器22端口连接超时 ssh: connect to host *** port 22: Operation timed out

启动hadoop出现ssh: connect to host master port 22: No route to host

CentOS系统中出现错误--SSH:connect to host centos-py port 22: Connection refused

容器下载的是centos8的镜像,scp出现packet_write_wait: Connection to **** port 22: Broken pipe 问题解决

github默认端口22被占用,ssh: connect to host github.com port 22: Connection timed out