0

I connected to my ubuntu server from my MacBook using SSH.

I want to know ip address of MacBook from the server.

How can I do that?

[edit] I would like to get ip using bash.

LogiBose
  • 3
  • 3

1 Answers1

0

I would comment this but I cant. We need more information. What language are you programming with. What have you tried.

Edit: Here is what you are looking for. This answer was taken from Find the IP address of the client in an SSH session

Please do a more through search for your problem before posting a question

Check if there is an environment variable called:

$SSH_CLIENT 

OR

$SSH_CONNECTION

(or any other environment variables) which gets set when the user logs in. Then process it using the user login script.

Extract the IP:

$ echo $SSH_CLIENT | awk '{ print $1}'
1.2.3.4
$ echo $SSH_CONNECTION | awk '{print $1}'
1.2.3.4
chillinOutMaxin
  • 182
  • 1
  • 13