SSH Tricks for Accessing Infolab Servers outside the Gates Building
SSH Logins
Most of the InfolabServers are only accessible within the Gates building network or on-campus. There are remote login machines for accessing them from outside of Gates, or off-campus, but logging in twice is an annoyance, and makes life hard when copying files, etc. So, here's how you can configure your ssh to make it feel like directly accessing them regardless of your location.
If you're using a Mac or Linux machine, add the following lines to your ~/.ssh/config file:
# try to share connection across sessions to the same host ControlMaster auto ControlPath ~/.ssh/master-%r@%h:%p # use remote login server for InfolabServers Host il*.stanford.edu madmax*.stanford.edu rulk.stanford.edu hulk.stanford.edu rocky.stanford.edu rambo.stanford.edu bruce.stanford.edu zarya.stanford.edu eel.stanford.edu snap.stanford.edu shark.stanford.edu skate.stanford.edu whale.stanford.edu silk.stanford.edu xenon.stanford.edu ProxyCommand ssh -q ${CS_PROXY_HOST:-shark}.stanford.edu exec nc %h %p
This will make all your ssh commands go through the remote login machine "shark" by default, and you don't have to worry about where you're accessing them from. When you need, you can specify a different remote login server on the fly over the CS_PROXY_HOST environment variable as follows:
CS_PROXY_HOST=xenon ssh server ...
When you want to transfer large amount of data directly from/to the server, you might want to bypass this proxy and session sharing configuration. You can either comment out the config lines above for a while, or disable those options with command-line arguments as follows:
ssh -o ControlMaster=no -o ProxyCommand=none server ... rsync -e 'ssh -o ControlMaster=no -o ProxyCommand=none' ... server: scp -o ControlMaster=no -o ProxyCommand=none ... server:
References
- ssh_config(5) man page
[http://nerderati.com/2011/03/simplify-your-life-with-an-ssh-config-file/ Simplify Your Life With an SSH Config File]
[http://sshmenu.sourceforge.net/articles/transparent-mulithop.html Transparent Multi-hop SSH]