👨‍🏫 Tutorial Basic Linux command to check who is connected to your SSH server.

R3g4z4k1

Established

SSH sets the environment variable SSH_CONNECTION to contain client IP address, client port number, server IP address, and server port number seperated by spaces.

You can use

echo ${SSH_CONNECTION%% *}

to get the client's IP address. To get the DNS name use something like host or dig -x:

host ${SSH_CONNECTION%% *}


dig -x ${SSH_CONNECTION%% *}

Sample Screenshot:

1715005060290.png


Thank you for your support!
Keep Learning!
Keep going!

Follow for more updates!
 

About this Thread

  • 1
    Replies
  • 634
    Views
  • 2
    Participants
Last reply from:
Umbrellaz

Online now

Members online
376
Guests online
3,727
Total visitors
4,103

Forum statistics

Threads
2,348,685
Posts
29,358,372
Members
1,094,657
Latest member
Dave Mumbundu
Back
Top