ssh:connect to host restart port 22: Connection refused
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
ssh:connect to host restart port 22: Connection refused
Hi guys I am getting "ssh:connect to host restart port 22: Connection refused" error when trying to start "ssh" in Ubuntu. I uncommented the port 22 in ssh_config, I dont have iptables setup...Did try to check if the port is listening using the netstat -an | grep "LISTEN" & couldnt find. Any solutions pls......
Hi guys I am getting "ssh:connect to host restart port 22: Connection refused" error when trying to start "ssh" in Ubuntu. I uncommented the port 22 in ssh_config, I dont have iptables setup...Did try to check if the port is listening using the netstat -an | grep "LISTEN" & couldnt find. Any solutions pls......
It sounds like the SSH daemon is listening on another port. Check the sshd_config file on the remote box and see what port it's configured to listen on, then use netstat to verify it's doing so.
BTW, this thread will likely be moved to a more appropriate forum, as it's not a security issue (at least not directly).
Do you have some other means of accessing the remote box? The objective being to make sure it's actually listening on that port, and that there are no interfering firewall rules. If the remote box sits behind a dedicated firewall, you'll want to check that too.
No I dont have a remote box as I am trying this in stand alone Ubuntu & I did install the openssh-server, I am first trying to start the server.
Uh, ssh_config isn't the server configuration file (it's the client configuration file). What you're looking for instead is sshd_config. Also, right after installation it should have generated the key pair and started itself up. If you need to manually start it, the command would be:
Code:
sudo /etc/init.d/ssh start
If you just execute the ssh command directly, you're running the client, not the server.
Yes I got the server started message, but when I tried to stop / start manually, it gave me the message, any clue??, I used the same code : sudo /etc/init.d/ssh start ....still getting the same error!!!!!
Yes I got the server started message, but when I tried to stop / start manually, it gave me the message, any clue??, I used the same code : sudo /etc/init.d/ssh start ....still getting the same error!!!!!
Something's not adding up here. The connection refused error message you posted looks like an SSH client error, not a server one. The server doesn't try to start a connection. What's the output of:
That looks sane. I'm not sure what to make of this. Since this is such an early stage, would you be willing to re-install the SSH daemon package? It would go like:
FWIW, this is what the installation looks like on my Ubuntu 8.10 box:
Code:
win32sux@candystore:~$ sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
rssh molly-guard openssh-blacklist openssh-blacklist-extra
The following NEW packages will be installed:
openssh-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 285kB of archives.
After this operation, 782kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com intrepid/main openssh-server 1:5.1p1-3ubuntu1 [285kB]
Fetched 285kB in 2s (114kB/s)
Preconfiguring packages ...
Selecting previously deselected package openssh-server.
(Reading database ... 213706 files and directories currently installed.)
Unpacking openssh-server (from .../openssh-server_1%3a5.1p1-3ubuntu1_i386.deb) ...
Processing triggers for ufw ...
Processing triggers for man-db ...
Setting up openssh-server (1:5.1p1-3ubuntu1) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
* Restarting OpenBSD Secure Shell server sshd [ OK ]
win32sux@candystore:~$ sudo netstat -pantu | grep LISTEN | grep ssh
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 19719/sshd
win32sux@candystore:~$ sudo /etc/init.d/ssh restart
* Restarting OpenBSD Secure Shell server sshd [ OK ]
win32sux@candystore:~$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.