SSH into a machine with a dynamic IP

Support this website by purchasing prints of my photographs! Check them out here.

If you're using my previous method for logging a networks ever-changing public IP to a webserver you control, you can use this simple command to grab the last known IP and SSH into the box that way.

ssh USERNAME@`curl -s`

The backticks, when run in a shell, will execute that command and return the results. In this case, it grabs the pong script, reading the IP address it provides, and the SSH's into it.

Tags: #linux
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.