Get IP of Remote SSH System
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2016
    Location
    Cape Canaveral
    Posts
    58
    Windows NT 10.0 Firefox 62.0

    Get IP of Remote SSH System

    Hello,

    I am having troubles accurately getting the IP of remote SSH connections. I dont think any type of NAT is involved in my case.

    My PC IP for instance is: 192.168.1.42

    SSH Env Vars (SSH_CLIENT & SSH_CONNECTION) display:
    Code:
      
      echo $SSH_CLIENT | awk '{ print $1}'
      10.200.3.151

    pinky shows the host name but when I ping it (mypc) is shows: 10.200.3.151


    Code:
    Login    Name                 TTY      Idle   When             Where
    (unknown)                 ??? ?:0       ?????  2018-02-23 15:51 :0
    michael                        pts/0    01:18  2018-09-24 09:29 mypc.local
    michael                        pts/1           2018-09-24 09:45 mypc.sccu.local

    What am I missing to get the accurate IP of what is connecting to my server via Putty\SSH?


    Thanks,

    Michael

  2. #2
    Join Date
    Oct 2011
    Posts
    1,865
    Linux Chrome 68.0.3440.106

    Re: Get IP of Remote SSH System

    Code:
    $ journalctl -b -u sshd.service | grep "Accepted password" | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"

  3. #3
    Join Date
    Nov 2016
    Location
    Cape Canaveral
    Posts
    58
    Windows NT 10.0 Firefox 62.0

    Re: Get IP of Remote SSH System

    srakitnican that is a cool technique. Thanks for sharing.

    Ladies and gentlemen...it was MY fault. In hindsight, the techniques I listed were accurately reporting the correct IP. I am usually much more thorough in checking things before wasting your time. Sorry.

    Thanks,

    Michael

Similar Threads

  1. Cannot ssh into remote system
    By Vector in forum Servers & Networking
    Replies: 17
    Last Post: 5th June 2009, 05:00 AM
  2. Remote control of a system
    By glennzo in forum Servers & Networking
    Replies: 11
    Last Post: 14th May 2008, 09:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •