Solved

User Origination

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

895 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

11 Experts available now in Live!

Get 1:1 Help Now