Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

User Origination

I want to change the .bashrc file so that it sets something up different depending upon if you're coming from one ip or another.  How do you find out which remote ip is telnetted into the current terminal?  Thanks in advance.
0
mnashadka
Asked:
mnashadka
1 Solution
 
willy134Commented:
if you do a
who -T
it will tell you what remote ip the user is coming from.

Unfortunately it lists all users currently logged on.  And when you are on the localhost it stats (0:0)

That answer is off the top of my head.  Give me some time to research it and I may find something else.  Unless someone already knows the answer.
0
 
shivsaCommented:
place this in your script.

PORT_ID=`who -m |awk '{print $6}' |sed "s/^(// ; s/)$//"`
0
 
mnashadkaAuthor Commented:
Thanks shivsa.  That did the trick.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now