ssh: Connection refused when access remotely

I recently installed ssh server openssh-server in my fedora 16. I added my friend user account to my sshuser list. When my friend tried to connect my server computer via ssh using following command

ssh [email protected]

then it shows following error

ssh: connect to host 192.168.1.123 port 22: Connection refused

but when i tried locally from my machine the server was connected.

root@localhost /]# ssh [email protected]
[email protected]'s password: 
Last login: Tue Feb 26 13:24:42 2013 from localhost.localdomain
[sudip@localhost ~]$ 

Also, my firewall is allowing SSH and SHH is running on port 22. So how can i troubleshoot the error??

thank you in advance.

EDIT: I already started sshd using service sshd restart

EDIT2: output of: iptables -n -L -v

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
46970   23M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
   11   616 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           
  133  8552 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
 2328  343K REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 59145 packets, 7665K bytes)
 pkts bytes target     prot opt in     out     source               destination

Edit 3: result of traceroute 192.168.1.123

traceroute to 192.168.1.123 (192.168.1.123), 30 hops max, 60 byte packets
 1  192.168.50.1 (192.168.50.1)  0.828 ms  0.805 ms  0.818 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

The workstation also uses fedora 16


You can use ssh -vvv [email protected] to get debug info on the connection. If -vvv is too much info you can use -vv or -v for less detailed debug info.

On the remote server, you should be able to see some info in /var/log/message or /var/log/syslog also.

A combo of those 2 things should point you in the right direction.


The Connection Refused message generally means that nothing is listening on that ipaddress:port. Check to see that sshd is listening on your 192.168.1.123:22

netstat -tnlp | grep :22
tcp        0      0 0.0.0.0:22          0.0.0.0:*           LISTEN      6809/sshd
tcp        0      0 :::22               :::*                LISTEN      6809/sshd

The above output is indicating that sshd is listening on all available ipv4 and ipv6 interfaces. If yours is different then you should check the ListenAddress directives in your sshd_config file.


Executing ssh -vv [email protected] will show you the detailed info of the SSH connetion. Also you can try "telnet 192.168.1.123 22" (telnet hostname port) in order to verify whether port 22 is listening.