Find the IP address of the client in an SSH session

后端 未结 19 1085
刺人心
刺人心 2020-12-12 10:48

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 fr

19条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 11:13

    Linux: who am i | awk '{print $5}' | sed 's/[()]//g'

    AIX: who am i | awk '{print $6}' | sed 's/[()]//g'

提交回复
热议问题