scp出現ssh port 22: Connection refused 問題解決具體步驟

來源:互聯網
上載者:User

標籤:ssh   scp   問題   

[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  

 以下是主要的關鍵步驟:

OpenSSH server on Mac OS X

OpenSSH server is part of Mac OS X and you don‘t need to install any additional package.

To enable the OpenSSH server of Mac OS X, open System Preferences:

650) this.width=650;" src="http://www.gooze.eu/sites/default/files/screenshots/openssh-001.png" />

 

Click on sharing and enable Remote Login:
650) this.width=650;" src="http://www.gooze.eu/sites/default/files/screenshots/openssh-002.png" />

This will start up OpenSSH server automatically.

 

直接關掉就儲存了,因為mac是時時儲存的。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.