- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- killing login session
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2005 05:35 PM
12-24-2005 05:35 PM
When i executed who command;i saw many user sksonkar (myself) logged in. When i used grep command i saw few session only.
Please see the output of both the command as shown below:-
#who
sksonkar pts/1 Dec 22 13:19
sksonkar ttyp4 Dec 24 13:50
sksonkar ttyp6 Dec 24 22:23
sksonkar ttyq7 Sep 26 11:15
sksonkar ttyq8 Sep 17 13:10
sksonkar ttyqa Sep 17 14:00
sksonkar ttyqf Sep 26 19:51
sksonkar ttyr0 Sep 26 20:15
sksonkar ttyr1 Sep 30 18:20
sksonkar ttyr2 Sep 28 21:32
sksonkar ttyr5 Oct 6 21:17
sksonkar ttyr7 Oct 6 22:14
sksonkar ttyr9 Oct 23 09:57
sksonkar ttyrd Nov 20 19:39
#
# ps -ef|grep sksonkar
root 9295 8880 2 22:24:57 ttypa 0:00 grep sksonkar
sksonkar 8863 8862 0 22:23:16 ttyp6 0:00 -ksh
sksonkar 8862 1 6 22:23:12 ? 0:00 /usr/bin/X11/xterm -fn 6x13 -sb -ls -display xx.xx.xx.xx
sksonkar 13792 13791 0 13:50:24 ttyp4 0:00 -ksh
sksonkar 13791 1 0 13:50:21 ? 0:00 /usr/bin/X11/xterm -fn 6x13 -sb -ls -display xx.xx.xx.xx
sksonkar 8878 8863 7 22:23:31 ttyp6 0:00 pbrun ksh
#
Please suggest how to kill these sessions shown by "who" command ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2005 07:16 PM
12-24-2005 07:16 PM
Solutionwho -l includes a process id
That might now work.
Based on your own output
ps -ef | grep sksonkar | awk '{print $2}' > plist
while read -r pid
do
kill ${pid)
done < plist
There are several variants of the who command that might be useful becaus they display process ID as noted above. They are on the man page and might prove useful in getting rid of these sessions.
Frankly when kiling processes, I prefer a human being is involved.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2005 11:21 PM - last edited on 03-27-2024 12:19 AM by Sunitha_Mod
12-24-2005 11:21 PM - last edited on 03-27-2024 12:19 AM by Sunitha_Mod
Re: killing login session
hi Shiv.
seems like your wtmp file is corrupted ...
read the following link http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=265607
and follow Robert-Jan 's suggestion....
regards.
[Moderator edit: The above link is no longer valid.]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 11:01 AM
12-25-2005 11:01 AM
Re: killing login session
below is the screenshots:-
$ who -l
$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 11:57 AM
12-25-2005 11:57 AM
Re: killing login session
# who -u
...lists (u)sers who are logged in. Adding '-R' as in 'who -uR' adds the hostname to the information returned.
# who -l ...
...lists only the lines on which logins are waiting to occur.
As noted, there are times when the 'etc/utmp' or 'var/adm/wtmp' files are corrupted and you will sense that someone has never terminated a login session when in reality it has been. More frequently, a simple 'ps' will expose orphaned sessions which can safely be killed ('kill -hup
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 02:12 PM
12-25-2005 02:12 PM
Re: killing login session
ps -f -u sksonkar
ps is always accurate as it reads the process table. who is dependent on the /etc/utmp file which can easily be corrupted with improper logouts. Since I see xterm processes, it appears that you may be using a PC with an Xterminal emulator. PCs have a tendency to crash a lot which means that the xterm windows (and associated logins) did not close properly. Since who determines whether a user has a session by looking in utmp, these crashed sessions appear to still exist.
Only ps is correct. If all you are using are xterm windows, you will find a performance improvement by using a plain terminal emulator rather than Xwindows. And in addition, the simple telnet protocol is less susceptible to bad entries in utmp.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 02:22 PM
12-25-2005 02:22 PM
Re: killing login session
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 03:55 PM
12-25-2005 03:55 PM
Re: killing login session
i would first trim my wtmp and btmp then run the "who -u" to identify the PID that i want to kill!
e.g.
# who -u |grep sksonkar
sksonkar pts/ta Dec 26 08:47 0:03 15578 t1
sksonkar pts/tb Dec 26 08:00 0:05 10501 t1
sksonkar pts/tc Dec 26 08:00 0:03 10554 t1
sksonkar pts/td Dec 26 08:29 0:24 13797 t1
sksonkar pts/te Dec 26 08:50 0:01 15767 t1
sksonkar pts/tf Dec 26 08:34 0:18 14376 t1
sksonkar pts/th Dec 26 08:37 0:07 14654 t1
sksonkar pts/ti Dec 26 08:52 0:01 16140 t1
sksonkar pts/tk Dec 26 08:55 . 16374 t1
# kill -15 15578 10501 10554 13797 15767 14376 14654 14654 16140 16374
hope this helps!
kidn regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 03:57 PM
12-25-2005 03:57 PM
Re: killing login session
i would first trim my wtmp and btmp then run the "who -u" to identify the PID that i want to kill!
e.g.
# who -u |grep sksonkar
sksonkar pts/ta Dec 26 08:47 0:03 15578 t1
sksonkar pts/tb Dec 26 08:00 0:05 10501 t1
sksonkar pts/tc Dec 26 08:00 0:03 10554 t1
sksonkar pts/td Dec 26 08:29 0:24 13797 t1
sksonkar pts/te Dec 26 08:50 0:01 15767 t1
sksonkar pts/tf Dec 26 08:34 0:18 14376 t1
sksonkar pts/th Dec 26 08:37 0:07 14654 t1
sksonkar pts/ti Dec 26 08:52 0:01 16140 t1
sksonkar pts/tk Dec 26 08:55 . 16374 t1
# kill -15 15578 10501 10554 13797 15767 14376 14654 14654 16140
hope this helps!
kidn regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 04:21 PM
12-25-2005 04:21 PM
Re: killing login session
# who -u | awk '/sksonkar/ { print $7; }' | xargs kill -9
-Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 05:27 PM
12-25-2005 05:27 PM
Re: killing login session
kill -9 `ps -ef|grep $LOGNAME|grep -v grep| defunct|awk '{print $2}'`
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 06:11 PM
12-25-2005 06:11 PM
Re: killing login session
Thanks everyone for your help.
One thing is not clear. As shown in my post above, who command shows more sessions but ps -ef|grep sksonkar shows fewer sessions.
Using kill command i can kill only those sessions who are visible using ps -ef|grep sksonkar command.
What is the easiest way to clean all the sessions which are showing up using who or who -u|grep sksonkar command ?
Thanks,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 06:17 PM
12-25-2005 06:17 PM
Re: killing login session
the use of xargs with the kill command
to kill off all processes associated with "ptc":
ps -ef | grep ptc | xargs kill -9 `awk '{print $2 }'`
to kill off all processes associated with "oli":
ps -ef | grep oli | xargs kill -9 `awk '{print $2 }'`
to kill off all processes associated with "etscape":
ps -ef | grep etscape | xargs kill -9 `awk '{print $2 }'`
Good Luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 06:19 PM
12-25-2005 06:19 PM
Re: killing login session
if you see man who:
The who command can list the user's name, terminal line, login time, elapsed time since input activity occurred on the line, the user's host name, and the process-ID of the command interpreter (shell) for each current system user. It examines the /etc/utmp file to obtain its information. If file is given, that file is examined. Usually, file is /var/adm/wtmp, which contains a history of all of the logins since the file was last created.
so you should start with trimming the /etc/utmp file...
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 08:15 PM
12-25-2005 08:15 PM
Re: killing login session
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=574109
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2005 10:59 PM
12-25-2005 10:59 PM
Re: killing login session
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2005 08:02 PM
12-26-2005 08:02 PM
Re: killing login session
who -Hu|awk '/sksonkar/ {print "kill " $7}'|sh
This command will kill all the pid showed by who command for user sksonkar.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2005 08:53 AM
12-27-2005 08:53 AM
Re: killing login session
sksonkar ttyqf Sep 26 19:51
What happens when you try to grep ttyqf?
ps -ef | grep ttyqf
If nothing shows up, like Bill said you are going to have to reboot and it will clear it up.
Like I said I have only seen this twice. These 2 occasions happened within on a couple of months apart, but with different seperate users and not myself and not so many of them like you. I was never able to figrue out what happened, only that it has stopped. On your system, you are the one with issues, I am curious to see if you can figure how happens
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2005 10:38 AM
12-27-2005 10:38 AM
Re: killing login session
After joining this forum i came to know how little unix i know.
Regards,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2006 08:51 PM
01-05-2006 08:51 PM
Re: killing login session
i want to take hp ux m/c archive to store in network pc using net_recover , pls give me some description on that.