|
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.
|