Allow connection sshd from other hosts

I set up an SSH server using Cygwin on windows. I was able to test it localy (ssh myAccount@localhost) but I encountered an error when trying from a distant machine.

ssh_exchange_identification: Connection closed by remote host

We have to allow connection from a distant machine inside /etc/hosts.allow on the server.
The syntax of this file is

<services separated by coma>:<hosts or IP separated by coma>[:command]

where command is the command to execute on a connection attempt

So I remove the PARANOID deny from the allow file (!?) and explicitly logged connection attempts from ssh.

# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
ALL : localhost 127.0.0.1/32 [::1]/128 : allow
ALL : PARANOID : deny
sshd: ALL
# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
ALL : localhost 127.0.0.1/32 [::1]/128 : allow
# sshd: ALL
# same directive while keeping track of attemps
shd: ALL: spawn (echo "Attempt from %h %a to %d at `date` by %u" | tee -a /var/log/sshd.log)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.