How to solve the ssh port 22: Connection refused problem in SCP

Source: Internet
Author: User
Tags openssh server ssh port ssh server

[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 becauseSSH server daemon, Or sshd, is not loaded and running on localhost, so any attempt to SSH connect to localhost wowould 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 cowould have is that your firewall cocould 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

The following are key steps:

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.

 

You can directly turn it off and save it because the Mac is always saved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.