Ubuntu – I cannot connect to OpenSSH server running on Ubuntu server from Git bash running Windows, through Cyberoam firewall in network

client-serverfirewalllinux-networkingsshUbuntu

Situation: I am trying to connect from OpenSSH client inbuilt with Git Bash running on Windows 7 professional x64 to OpenSSH server that runs on Ubuntu Server LTS 14 x64. Both of which are over the same local network, that is monitored by Cyberoam.

Also I need to mention that the server installation is fresh and for now I am the only one who is trying to connect to the system.

Problems:

  • Out of 100 tries to connect from client, hardly 5 attempts are successful, and the rest are rejected by server, i.e. I cannot connect to the server from client, in normal process.
  • Sometime right after successful long in, I get disconnected from server, I do not think it is the problem with time out.

Ideal solution: I should be able to connect to from client to server for each single attempt. Server should not refuse the connection.

More details:

  • If I run run the SSH command from client in debug mode, I get:

$ ssh -vvv 192.168.0.120
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.120 [192.168.0.120] port 22.
debug1: connect to address 192.168.0.120 port 22: Connection refused
ssh: connect to host 192.168.0.120 port 22: Bad file number

This is not the only message I get, sometimes at the end of the list, there is an error from the server.

  • SSH is running over the default port, 22.
  • If I use PortQry.exe to test the port and IP accessibility, I get no issue.

$ portqry -n 192.168.0.120 -e 22
Querying target system called:
192.168.0.120
Attempting to resolve IP address to a name...
Failed to resolve IP address to name
querying...
TCP port 22 (ssh service): LISTENING

  • As mentioned the connection is gone though a a phycal firewall called Cyberoam, that has been newly reconfigured and all the problems started since then.
  • I have checked /var/log/auth.log, but there is no entry for remote access via SSH from client machine.
  • I have already set the keys on client and server, and I can log in with out password.
  • I can ssh to server itself with no issues.

Best Answer

Something like this where the problem is intermittent, and (by your own description) caused by a firewall, I would immediately look at IPS. Ask your network admin to disable the Intrusion Prevention Service for 22/tcp to 192.168.0.120.

Related Topic