Last Friday, 7/8/2011, just before closing time, my monitor on my primary development machine broke. The screw attaching the monitor’s arm to the base snapped clean in half, leaving a perfectly good monitor with no way to stand on its own. An unfortunate circumstance but one that is easily remedied with a new screw (or, in the case of Amazon’s customer service, a brand new monitor).
This left me in an unfortunate position come Monday morning when trying to get into my machine to start my day. Luckily, I had brought another computer and had Dropbox installed on the now headless development machine.
All I needed to do until the new monitor arrives is to SSH into the machine, with the possible exception of running a VNC client to access some of the Eclipse GUI elements. However, in order for SSH to work properly, one needs an IP address of the target computer. How would I get this? After running an uninformative NMAP scan (too many machines on the network to pinpoint mine) I realized I had already installed Dropbox on the machine. Following are the steps I used to gain the IP address of my development box in order to SSH into it:
1. After booting the machine, login (hit ‘Enter’ then type password – will depend on how your login process is configured)
2. Press keys ‘cntrl-alt-T’ (This will open a Terminal window)
3. Type ‘cd Dropbox’ (this too will depend on how you’ve installed Dropbox – I’ve set mine to the default location)
4. Type ‘ifconfig > ipaddr.txt’ (without the ‘ character)
You should now have a .txt file in your Dropbox folder with the IP address of the development machine! From here you can use that IP address to SSH into the development box! It’s an easy and clever little trick to get the IP address of a headless machine (provided you have Dropbox installed. If you don’t, you may want to look into piping ‘ifconfig’ into a ‘sendmail’ command).