SSH into a machine with a dynamic IP

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 http://www.example.com/pong.php`

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 is the author of Advanced Microservices and is a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.