21

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 using Ubuntu 10.

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 

5 Answers 5

16

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.

13

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.

3

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'.

4
  • Edited question to show results of ps -ax. Not sure what it means. Commented Sep 23, 2011 at 11:11
  • 1
    It means ssh is not running. Commented Sep 23, 2011 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. Commented Sep 23, 2011 at 12:46
  • 3
    The list of processes does not include an sshd process, which means sshd is not running. The solution is to start sshd. Commented Sep 23, 2011 at 12:51
2

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

$ ssh -vv eric@myserver 
0

I faced this issue too, but in a VirtualBox environment, so to solve it we need to set the IP address to be in the same LAN segment; for example:

On my host machine, I open cmd and type ipconfig. I get 100.2.2.1 (for example).

So in the virtual machine we must set the VM's address in /etc/hosts to a value like 100.2.2.3, take a look in the final number, and bounce the virtual machine, but before start up the virtual machine configure the network in the settings of the virtual machine, so we need to set the network adapter in bridge connection.

All of this is in a Solaris environment.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.