Technical article 127609

How do I test to see if sshd is working?

OpenServer 6.0.0OpenServer 5.0.7UnixWare 7.1.4

Written · Last revised

Problem

How do I check to see if sshd is working? When I try to connect to the server the connection times out.

Solution

To check sshd is working correctly use the following steps:

1. Check networking is working to the server with the use of "ping" or "telnet".

2. Assuming you have a working network check using:

# ps -ef | grep sshd

For OpenServer, this should say "/etc/sshd". For UnixWare7, this should say "/usr/sbin/sshd".

If not, then the sshd daemon has not started for some reason.

It is started within /etc/rc2.d/S85tcp on OpenServer and /etc/rc2.d/S98opensshd on UnixWare7.

See "man sshd" for further information in starting the sshd daemon.

3. Assuming the sshd daemon is running, test locally to ensure the problem is not network related with:

# ssh localhost
See "man ssh" for further information.

If no response is given then check that port 22 (the default port) is open with:

# netstat -an | grep 22
We are expecting:
tcp        0      0  *.22                   *.*                    LISTEN

If not, then the server is preventing port 22 from listening or you have configured sshd to listen on a different port and you should check the "sshd_config" configuration file.

See "man sshd_config" for further information.

4. Assuming, that port 22 is open, test using:

# telnet localhost 22
A successful connection will say:

Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. SSH-1.99-OpenSSH_4.6

If not, then it's likely 'sshd' is trying to resolve it's name and is unable to.

Check the configuration of DNS and the server's local DNS configuration by:

# cat /etc/resolv.conf

to ensure that there is a valid configuration there.

See also

man ssh
man sshd
man sshd_config

From the Xinuos technical article database, record 127609. Reproduced with permission. The original is at www.sco.com/ta/127609, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.