![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running a script during logoff | praveenkumar_l | UNIX for Advanced & Expert Users | 3 | 06-13-2007 02:58 AM |
| list the names of users who logoff in last 4 minutes | jax_anchal | Shell Programming and Scripting | 2 | 10-03-2006 04:07 AM |
| Apparent logoff’s due to inactivity. | gadgetman | SCO | 0 | 08-29-2006 07:07 PM |
| Logoff a user... | balaji_prk | AIX | 6 | 12-05-2005 09:03 AM |
| logoff idle user script | michieka | UNIX for Dummies Questions & Answers | 4 | 05-24-2002 06:47 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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.
__________________
Regards from Phpote |
| Forum Sponsor | ||
|
|
|
|||
|
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) |
|
|||
|
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. |
|
|||
|
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. Code:
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).
|