1

I'm not able to do ssh to other machines in my LAN not even other machines are able to ssh to my machine (except 2 machines). My firewall service is off, network is also of the same n/w. sshd also using port 22, I've searched a lot and tried everything, but still no luck.

Note : ssh works for public servers and 2 machines from my LAN

I have entered command SSH with o/p:

[KS131@localhost ~]$ ssh -vvv  KS122@192.168.1.41
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /home/KS131/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "192.168.1.41" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.1.41 [192.168.1.41] port 22.

After long time:

debug1: connect to address 192.168.1.41 port 22: Connection timed out
ssh: connect to host 192.168.1.41 port 22: Connection timed out

Command iptables -L o/p:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     anywhere            
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc

Any help would be appreciated, Thanks.

  • do you have administrator access on the servers so you can check their logs (e.g. /var/log/secure or /var/log/auth.log)? Can we assume from your tags that the servers are running centos (and what version)? – drewbenn Jan 18 '18 at 6:51
  • @drewbenn My machine is centos7, saw /var/log/secure, nothing is there after timeout – Nitin Dhomse Jan 18 '18 at 6:53
  • Just to be absolutely sure... what is the output of iptables -L? – maulinglawns Jan 18 '18 at 7:03
  • @maulinglawns : I've added iptables -L o/p in the question. – Nitin Dhomse Jan 18 '18 at 7:06
  • Can you connect between systems on your LAN on other ports? It's not unusual for Wi-Fi networks in particular to limit connection between hosts on the network. – mc0e Jan 18 '18 at 7:44
1

Do following checks to make sure the clients have permissions to ssh to your server:

  1. Ensure /etc/hosts.allow and /etc/hosts.deny is not configured.
  2. In /etc/ssh/sshd_config, make sure you have committed below settings.

PermitRootLogin
AllowUsers
AllowGroups
DenyUsers
DenyGroups

  1. Make sure you have upgraded to the latest ssh for both clients and your server.

Plus, you can also debug from the server side:

  1. Stop sshd daemon via /etc/init.d/sshd stop or systemctl stop sshd if you are running RHEL 7+ or Ubuntu 16.04+.
  2. Manually issue the sshd daemon with the -ddd parameter

    /usr/sbin/sshd -ddd

  3. Now, try to connect from the client side, you will see verbose information on your server screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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