Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying:

$ ssh eric@myserver

where myserver is a machine in the intranet. I can ping myserver or respond to HTTP on port 8080, etc, but when I try ssh, I get

ssh: connect to host myserver port 22: Connection refused

I'm somewhat new to linux, and I don't know how to troubleshoot this. I'm using Ubuntu 10 if that matters.

Edit: trying ps -ax, as suggested gives:

eric@Isaiah:~$ ps -ax | grep ssh
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
 1641 ?        Ss     0:04 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
18376 pts/3    S+     0:00 grep --color=auto ssh
share|improve this question
add comment

4 Answers

up vote 6 down vote accepted

You don't have an SSH daemon running. If you look at the output from the ps ax command, you see that the only two processes with 'ssh' in the description are ssh-agent (which does something entirely different from sshd) and the grep ssh process that you're using to filter the output of ps.

Depending on what distribution installed, you may need to install or run the ssh server, usually called openssh-server or sshd depending on your package manager.

share|improve this answer
add comment

Steps for debugging the above problem:

  1. Use nmap tool to know which ports are open in that server. nmap is a port scanner. Since it may be possible that ssh server is running on a different port. nmap will give you a list of ports which are open.

     $ nmap myserver
    

2 . Now you can check which server is running on a given port. Suppose in the output of nmap, port 2424 is open. Now you can which server is running on 2424 by using nc(netcat) tool.

 $ nc -v -nn myserver portno

Suppose the output of 2424 port is:

myserver 2424 open
SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu5

This means ssh is running on 2424.

Keep on changing the portno in the above command and check for all the ports which are listed open by nmap.

share|improve this answer
add comment

That means either the ssh server isn't running on that machine or the firewall isn't allowing ssh through. You can check if ssh is running with 'ps -ax | grep ssh'.

share|improve this answer
    
Edited question to show results of ps -ax. Not sure what it means. –  Eric Wilson Sep 23 '11 at 11:11
    
It means ssh is not running. –  David Schwartz Sep 23 '11 at 11:34
1  
Weird. I'm not sure why you have twice now offered help that is not really helpful. First you suggest a command useful to check if ssh is running, without telling me how to interpret the results. Then you provide the minimal interpretation of those results, without a hint as to how you arrived at that interpretation, or what action might be appropriate. I'm not sure whether you are trying to help me, and are misjudging my level of experience, or if you are trying to highlight my ignorance. –  Eric Wilson Sep 23 '11 at 12:46
    
The list of processes does not include an sshd process, which means sshd is not running. The solution is to start sshd. –  David Schwartz Sep 23 '11 at 12:51
add comment

The previous two options are good. You can also use the -v or -vv arguments.

$ ssh -vv eric@myserver
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.