logoff ghost user

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers logoff ghost user
# 1  
Old 07-24-2001
Hammer & Screwdriver logoff ghost user

I just noticed by running a who command that I was logged in twice . So two admin2 are on the list. (solaris 2.6)
Since I telnet using a windows 98, I suppose that I forgot to CTRL-D last time I logged in and clicked on hangup.
In such a case, how can I loggoff the old ghost loggin ?
It's not a process so cannot use KILL, or can I ?
Securitywise, it does not look so wise to have an open loggin.

Thanks for your enlightments.

# 2  
Old 07-24-2001
kill -9`ps -ef|grep $user|grep (pts/??|tty?)|awk '{ print $2 }'`

there ya go. all you need to know is the user and the pts or tty you want to knock off. ;} even zombie prossesses have a proccess id (i beleave)
# 3  
Old 07-24-2001
when you type in who you'll see your username and the terminal you're using ... eg:

admin2 ttyp1
admin2 ttyp3

with a second command "who am i" you can find out the terminal you re using in the moment:
admin2 ttyp3 ....

so you know that ttyp1 was the terminal from before ... search for processes running on that terminal:
ps -ft ttyp3

then you can kill all processes running under this terminal.

BUT: I can be that who is still showing you logged in ... never found out when and why this information is not leaving

BUT #2: If there are no processes runnning it makes no difference if who is showing you logged in or not.
The only point which could be important is that you lose one number from the number of maximal ttys.
# 4  
Old 07-24-2001
for sakes of argument if you do a "w" and get the list of users loged in (which reflects from /var/adm/wtmp) and you noticed that there are no process running you can just wipe out that file but in that process you would also lose anyinfo for anyone logged in. you can also use the last command to see if it is actually still logged in (if it is it should most deffinetly have a PID.)

if it is showing up it has to have a pid zommbied or not.

man last

The last  command looks in the  /var/adm/wtmpx  file,  which
     records  all  logins  and  logouts,  for information about a
     user, a terminal, or  any  group  of  users  and  terminals.
     Arguments  specify  names of users or terminals of interest.

man utmp
The utmp database file contains user access  and  accounting
     information  for  commands  such  as  who(1),  write(1), and
     login(1). The wtmp file contains the history of user  access
     and accounting information for the  utmp database. The data-
     base contained in these files can be manipulated  using  the
     getutent() family of functions.  Entries in the database are
     described  by  the  definitions  and  data   structures   in
     <utmp.h>. See getutent(3C).

please correct me if i am wrong.
# 5  
Old 07-24-2001
Wouldn't it be safer to do a `kill -1` or `kill -HUP` on each of those idle or zombie sessions? I suppose that a -15 or -9 would be needed in some cases, but if you made a mistake, it would be easier to recover from Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Blank Screen after logoff server via vnc Viewer.

Hello All, I have installed VNC Server on Ubuntu system to access this system from windows machine i'm using VNC Viewer. When i logged off the server from windows machine through VNC Viewer its showing blank screen only... Kindly help. Regards, Purushottam Aher (0 Replies)
Discussion started by: purushottamaher
0 Replies

2. Shell Programming and Scripting

My script stops after logoff...why??

Hi' i am runing a script thats run with a loop...while loop true. when i exit the server..logon and again the script doenst run. its a bash script test.sh. i run it as: #./test.sh & what can be the priblem please? thanks alot (6 Replies)
Discussion started by: zigizag
6 Replies

3. Shell Programming and Scripting

Case Statement for Login/Logoff Script

I'm currently trying to write a login script. I have already written a logoff script that uses an if/else statement. #!/bin/bash TIMED=$(date +%H) if ' then echo Have a Great Day $USER else echo Have a Great Night $USER fi But I'd like to write one that give me the option of... (1 Reply)
Discussion started by: bbowers
1 Replies

4. Shell Programming and Scripting

Logon/Logoff script

I need help for writing a logon/logoff script for recording user's computer usage time. This is for local login only, not for ssh or something like that. When a user logon, there should be a temp file (/home/acct/login_temp) generated including the logname and logon time information in the... (8 Replies)
Discussion started by: jimx
8 Replies

5. AIX

Track user logoff in AIX 5.3

Hi Does anybody know if there is a way in AIX 5.3 to track how a user was logged off? For instance where the user typed exit, hit crtl D, shell process was killed, etc. I know of the last log entries but this just shows a users login time and duration. I also tried syslog but I only get login... (5 Replies)
Discussion started by: kimyo
5 Replies

6. UNIX for Advanced & Expert Users

Running a script during logoff

I know we can put whatever we need to run during login inside /etc/profile or .profile file. I want to run a set of commands before logoff. Where should I put my commands/scripts? Is such facility available? (3 Replies)
Discussion started by: praveenkumar_l
3 Replies

7. Shell Programming and Scripting

list the names of users who logoff in last 4 minutes

i am new to unix shell program, please someone hint me how to get the names of users who make logouts in last 4 minutes? i dont need complete script, but only the guide (2 Replies)
Discussion started by: jax_anchal
2 Replies

8. SCO

Apparent logoff’s due to inactivity.

I have run across an issue with the last two Dell Poweredge servers I have attempted to deploy. I seems that when a telnet session sits idle for 5 to 30 minutes (seems random) the session is being closed and users are logged off. If the session has user activity there is no problem staying... (0 Replies)
Discussion started by: gadgetman
0 Replies

9. AIX

Logoff a user...

Hi... could anyone tell me how to kill a user session on my server with out affecting other user? Bala (6 Replies)
Discussion started by: balaji_prk
6 Replies

10. UNIX for Dummies Questions & Answers

logoff idle user script

Will someone please share a script with me that will read in each line of the who -u output and if idle time is more than 50 min, execute a kill on the PID? This is what I have so far: who -u | cut -c 40-56 I am comfortable in the korn shell, but I can broaden my horizons if you've got... (4 Replies)
Discussion started by: michieka
4 Replies
Login or Register to Ask a Question