I have a script that is to be run by a person that logs in to the server with SSH.
Is there a way to find out automatically what IP address the user is connecting from?
Of course, I could ask the user (it is a tool for programmers, so no problem with that), but it would be cooler if I just found out.
Best Answer
Check if there is an environment variable called:
OR
(or any other environment variables) which gets set when the user logs in. Then process it using the user login script.
Extract the IP: