SSH-dependent Autolauncher for UNIX/Linux

I am root If you see me laughing you better have a backup!

So one day I was playing with my computers environment variables, as usual, when I discovered that I could determine whether or not a user was logged in via SSH! If a user is logged in over SSH, an envirment variable named $SSH_CONNECTION exists, containing the IP address of the client's workstation. If the user is not logged in by SSH, that environment variable simply will not exist.

This meant that I could write a program in any language to read the $SSH_CONNECTION variable; upon failure it would report that the user is logged in locally, and upon success it would have the client's IP address. Furthermore, simply knowing the state of the users' connection opens up possibilities. For example, the program shown here will automatically launch Mozilla Firefox if compiled with -DFIREFOX.

  • A Makefile is provided on this site to aid in compilation/installation, and some brief instructions are provided on how to use the .mycshrc file to automatically launch programs in UNIX/Linux.
  • I should note that Bash users should disregard the instructions for .mycshrc and instead edit the file named .bashrc.
  • Send questions/complaints/etc. to W. John Holden.