I have an account at a server at school, and a home computer that I need to work with sometimes. I have exchanged keys, and now only have one problem. While my school account has a name associated with it, “account_name@school”, my home network does not. My plan is to have a script that every hour retrieves my home network’s IP address, ssh’es into my school account and updates my ssh config file storing my home network’s IP address.
How can I retrieve my home computer’s IP address from a shell script?
P.S. Is this a sensible plan?
I figured out a better way to get the IP address then to use an external service. I am SSHing into the server; therefore, the server must know who is SSHing into it, so I can use a tool like who or pinky to find out who is SSHing in.
Here is the command to get the name of the computer logged in.