I'm having troubles ssh-ing to a server (ubuntu 16.04) I have root access to from my machine (macOS 10.12). The situation is weird: I checked that sshd is running on the server and that the port 22 is open (sudo netstat -anp | grep sshd) and traffic isn't blocked (sudo iptables -L | grep ssh and sudo ufw verbose); hosts.deny does not have my IP address either.
Weirdest thing - I can login from another machine with no problem. When I run nmap <server-ip> on my machine it shows only port 80 is open; running the same command on another machine gives only one open port - 22. I tried logging in from third machine - no luck again. Not sure of what's going on.
I need some way (tail -f logs, probably) where I can see what is actually happening on the server when I try to connect from different machines. Maybe this will help me to troubleshoot. Any advices on how shall I debug this problem?
sudo tcpdump dst x.x.x.x and dst port 22, replacing x.x.x.x with the actual IP address, try to connect from your macOs machine and check if you have anything printed on the screen. If yes - check the servers firewall rules. If not the problem is either in your macOs or in the routers/firewalls between it and the server. – sмurf Sep 06 '17 at 00:48