Solved

User Origination

Posted on 2003-11-11
3
301 Views
Last Modified: 2010-04-21
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
Comment
Question by:mnashadka
3 Comments
 
LVL 5

Expert Comment

by:willy134
ID: 9726188
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
 
LVL 24

Accepted Solution

by:
shivsa earned 125 total points
ID: 9729318
place this in your script.

PORT_ID=`who -m |awk '{print $6}' |sed "s/^(// ; s/)$//"`
0
 
LVL 8

Author Comment

by:mnashadka
ID: 9731822
Thanks shivsa.  That did the trick.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question