SSHing into a dynamically changing IP

I made a poster for my desktop so I don’t have to check what my ip address is whenever I go out.

The script is so simple:

wget icanhazip.com

scp index.html server:posting_destination

rm index.html

Then I run this with a cronjob set to once a day.

Obviously it depends on icanhazip.com not dying any time soon, but I can just change it to another one.

The challenge here was that I post to my athena locker, which doesn’t allow ssh keys. Instead of figuring out this mess of kerberos auth-token stuff, I just hard code in my password (oh god) but I think it’s okay because the script is only on my computer. However, scp doesn’t accept hard coded passwords, so I made a small script using Expect, a program that interacts with interactive programs (haha).

A more interesting problem would be to write a server that listens to incoming pings and posts their IP addresses. Maybe I’ll do that next.

Tags: oneyeardev