Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
02-19-2010, 11:09 PM
|
#1
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Rep:
|
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......
VIJNB
|
|
|
02-19-2010, 11:12 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally Posted by myubuntu
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).
Last edited by win32sux; 02-19-2010 at 11:16 PM.
|
|
|
02-19-2010, 11:15 PM
|
#3
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Original Poster
Rep:
|
ssh:connect to host restart port 22: Connection refused
Hey thanks for your reply, checked the sshd_config, its also in port 22, any other solution
|
|
|
02-19-2010, 11:17 PM
|
#4
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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.
Last edited by win32sux; 02-19-2010 at 11:19 PM.
|
|
|
02-19-2010, 11:21 PM
|
#5
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Original Poster
Rep:
|
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.
|
|
|
02-19-2010, 11:26 PM
|
#6
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally Posted by myubuntu
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.
Last edited by win32sux; 02-19-2010 at 11:27 PM.
|
|
|
02-19-2010, 11:32 PM
|
#7
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Original Poster
Rep:
|
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!!!!!
|
|
|
02-19-2010, 11:38 PM
|
#8
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally Posted by myubuntu
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:
Code:
sudo netstat -pantu | grep LISTEN
|
|
|
02-19-2010, 11:42 PM
|
#9
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Original Poster
Rep:
|
the output is
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 936/cupsd
tcp6 0 0 ::1:631 :::* LISTEN 936/cupsd
udp 0 0 0.0.0.0:68 0.0.0.0:* 979/dhclient
udp 0 0 0.0.0.0:5353 0.0.0.0:* 789/avahi-daemon: r
udp 0 0 0.0.0.0:47477 0.0.0.0:* 789/avahi-daemon: r
|
|
|
02-19-2010, 11:45 PM
|
#10
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
What about the output of:
Code:
sudo /etc/init.d/ssh restart
|
|
|
02-19-2010, 11:48 PM
|
#11
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Original Poster
Rep:
|
Quote:
Originally Posted by win32sux
What about the output of:
Code:
sudo /etc/init.d/ssh restart
|
the same error - ssh:connect to host restart port 22: Connection refused
|
|
|
02-19-2010, 11:51 PM
|
#12
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally Posted by myubuntu
the same error - ssh:connect to host restart port 22: Connection refused
|
Weird, it's like the SSH daemon's startup script is acting like a client.
What about :
Code:
ls -l /etc/init.d/ssh
And:
Code:
head /etc/init.d/ssh
|
|
|
02-19-2010, 11:56 PM
|
#13
|
LQ Newbie
Registered: Feb 2010
Posts: 23
Original Poster
Rep:
|
Quote:
Originally Posted by win32sux
Weird, it's like the SSH daemon's startup script is acting like a client.
What about :
Code:
ls -l /etc/init.d/ssh
And:
Code:
head /etc/init.d/ssh
|
>> the output is.....
root@mgroms:~# ls -l /etc/init.d/ssh
-rwxr-xr-x 1 root root 3878 2009-10-22 15:50 /etc/init.d/ssh
root@mgroms:~# head /etc/init.d/ssh
#! /bin/sh
### BEGIN INIT INFO
# Provides: sshd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: OpenBSD Secure Shell server
### END INIT INFO
|
|
|
02-20-2010, 12:00 AM
|
#14
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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:
Code:
sudo apt-get remove --purge openssh-server
sudo apt-get install openssh-server
Like I said, after that last command it should be up and running without the need for you to edit anything.
|
|
1 members found this post helpful.
|
02-20-2010, 12:18 AM
|
#15
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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:~$
Last edited by win32sux; 02-20-2010 at 12:26 AM.
|
|
|
All times are GMT -5. The time now is 03:59 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|