Saturday, April 2, 2022

Ubuntu/Linux: How to tell if a Port is Open on a Remote Host

While trying to get ssh working to a remote host, I encountered the "Connection refused" error message on Ubuntu.  The first step in debugging is to make sure the port is open on the remote host which can be done as follows:

echo > /dev/tcp/<remote host>/<port> && echo "The port is open"

Checking to see if ssh (port 20) is open on a host (10.0.0.37) is simply:



To verify script snippet works I did tested it against HTTPS (port 443) on a well know host (google.com):




No comments :

Post a Comment