find station from where is logged in


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find station from where is logged in
# 1  
Old 01-22-2007
find station from where is logged in

for secure access purposes I want to know where somebody logs in
working in K shell

I have
who am i= giving user and terminal =gxb pts/4 Jan 22 15:0

finger user => gives all sessions of user
=
Login name: gxb
Directory: /home/gxb Shell: /sbin/ksh
On since Jan 22 15:05:31 on pts/4 from BS-013
No unread mail
No Plan.

I want to get the BS-013 !!

grep to find the terminal and the corresponding station ( station or ip address )

I tried
grep 'who am i |cut -c12-20' but this is not working

any ideas
# 2  
Old 01-22-2007
Hi ,try:
Code:
grep "$(who am i |cut -c12-20)"

Cheers
# 3  
Old 01-22-2007
is this useful?

Code:
who -R

could be useful. I am on HP-UX.
# 4  
Old 01-23-2007
Code:
who -u

works on every platefrorm ...
# 5  
Old 01-23-2007
Hello,

thank you already
who -R is not working, I am on SINIX ( older Siemens UNIX version)
who -u shows me all the users and the terminal.
I need the station ( is available in finger )
# 6  
Old 01-23-2007
Quote:
Originally Posted by ghislain
Hello,

thank you already
who -R is not working, I am on SINIX ( older Siemens UNIX version)
who -u shows me all the users and the terminal.
I need the station ( is available in finger )
Try this:
Code:
finger -m username | awk 'NR==3{print $NF}'

# 7  
Old 01-23-2007
I do not know the awk but it works.
However, this works when the user has 1 session.
He can have more sessions: the virtual terminal is then different and it is important to have the correct terminal-workstation info

as far as logic i had thefollowing in mind
with who am i: i find the virtual terminal
with finger user: i find the several sessions and corresponding terminals and workstations
with ? grep or other I take the correct line based on the terminal from who am i
with cut I take the workstation info out of that line
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to find users not logged in for 90 days

Dear All, I need your help in finding out users not logged in to linux system for more than 90 days. I found a script from our forum i am getting error while using that. from the code i have debugged line by line to see where i am getting the problem. i found out the below line i am getting... (5 Replies)
Discussion started by: Sachinlinux
5 Replies

2. UNIX for Dummies Questions & Answers

Find who logged in system apart from myself

Hi, I need to find the users logged in the system beside me. as uname -u gives all the user and uname -um gives the current user on system. How can i get result of uname -u minus uname -um . I want to do it in one line. tried with grep but not successful. (6 Replies)
Discussion started by: kailash19
6 Replies

3. UNIX for Dummies Questions & Answers

how to find top 3 users currently logged on

For the first 3 users only that are currently logged in output their effective user id. thank you. (6 Replies)
Discussion started by: whyatepies
6 Replies

4. Shell Programming and Scripting

find top 4 users currently logged on can i use grep

For the first 4 users only that are currently logged in output their effective user id. It's not important the order in which each logged in i just want to have the top 4. Same question as here...... (0 Replies)
Discussion started by: whyatepies
0 Replies

5. Shell Programming and Scripting

Script to find systems logged in with a particular userid

Hello All, I need to design a script to get all the systems names(IP Addresses) logged in with a particular userid say 'xyz' from different terminals. This is to track the use of the particular userid and take action if it is being misused. The script would accomplish the following steps: 1.... (1 Reply)
Discussion started by: mehimadri
1 Replies

6. Ubuntu

How can we find out who are all logged out recently?

Hi, I need to find out who are all the users logged out recently or some minutes or some hours ago. :b: (4 Replies)
Discussion started by: balan_mca
4 Replies

7. Solaris

how to find who logged in

Hi, How do I find who logged in last 30 days? I have last command command, but is there any option to find only last 30 days? Thanks in advance. (0 Replies)
Discussion started by: mokkan
0 Replies

8. Shell Programming and Scripting

to find the number of users logged in

Hi, can u say to display the number of users that logged before me. thanks (10 Replies)
Discussion started by: shanshine
10 Replies

9. UNIX for Dummies Questions & Answers

know who logged and logged out with their timings

being ordinary user (not having any administrative rights) can avail myself a facility to know who logged and logged out with their timings get popped onto my terminal as if it get echo 'ed... (3 Replies)
Discussion started by: vkandati
3 Replies

10. UNIX for Dummies Questions & Answers

18Gb HD with Sparc Station 5 ?

Hello all, A quick question on Sparc Station 5. Can I use 18GB hard disk with Sparc Station 5 ?. I searched sunsolve documentation. It gives info only upto 4.2 GB for sparcstaton 5. The OS is SunOS 5.5.1 Thank You, (3 Replies)
Discussion started by: shibz
3 Replies
Login or Register to Ask a Question