Solved

User Origination

Posted on 2003-11-11
3
299 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

762 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now