Let’s say you are working from home, but you need to do a code review or want to do pair programming or something. I was in this situation last week with a good friend. He lives about 45 minutes from me and neither of us were really in the mood to do any driving. We are both working on macbooks. I was planning on driving the programming session, so he put together the following instructions for setting up SSH access to my computer
Steps for setup:
- Open TCP port of your choice on the router and forward that to port 22 of the IP for your Mac (ifconfig @ command prompt, or use the network control panel to get your IP).
- Create a user/pwd that I can use to connect with in the Accounts Preferences Panel*
- Turn on Remote Login in the Sharing Preferences Panel (System Preferences).
- Turn on Screen Sharing.
- Add that user to the list of who can connect in the Allow access list box.
- Go to the Firewall preference panel and click on Advanced… Ensure that ssh is allowed through.
Finally, I gave him my IP address and his account information and he logged in through SSH, started screen sharing and was then viewing EVERYTHING I was viewing on the screen. We also started up iChat and started a voice chat through our AIM connection. The sound was actually very good and the screen sharing performance was also very good. My friend said he could see the change on the screen as soon as he heard the key press through the microphone.
In order to connect, he issued the following command line.
ssh -p <yourport> -f -L 1200:localhost:5900 <iphere> sleep 10 ; open vnc://localhost:1200
where <iphere> is replaced by the ip address I sent to him, and <yourport> is the port specified in step one. Note that the username I setup on my machine was the same as the username he uses on his machine so he didn’t have to specify a username at login time.
We worked for about 3 hours this way, talking and programming without any issues. Will it 100% replace in-person pair programming or code reviews, certainly not, but I plan to use it a lot with my buddy.
*You probably shouldn’t be sending the username/password combination to your friend through email or something like that. I called mine to give him that sensitive information.