- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Logging out a user from the command line
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
Discussions
Discussions
Discussions
Forums
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
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
тАО06-23-2010 06:59 AM
тАО06-23-2010 06:59 AM
There is a user account, test, on one of our servers, HP-UX 11.11, that has been idle for some time, and I want to log off the system.
Do I need to use the su - command syntax to switch to that user to do the log off, or is there another command that I can run as root to accomplish this task.
One approach I thought of using ps in conjunction with the kill command.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 07:05 AM
тАО06-23-2010 07:05 AM
SolutionTo use 'su' you would have to be running the session you want to eliminate, so that makes no sense.
I presume that the user's session was aborted from his/her end by an abortive disconnect (of a PC emulator). Simply 'kill' the pid that represents the old, idle session. You may need to do a 'kill -9
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 07:16 AM
тАО06-23-2010 07:16 AM
Re: Logging out a user from the command line
Thanks for your reply. I ran the ps command with the grep test and -u test syntaxes, and while they showed processes owned by the test user account, they did not show the pid for the user session.
What would the correct syntax be to determine the pid for the user session? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 07:45 AM
тАО06-23-2010 07:45 AM
Re: Logging out a user from the command line
> What would the correct syntax be to determine the pid for the user session?
# who -u
...will show you login sessions (which is what I assume you see as "idle".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 07:51 AM
тАО06-23-2010 07:51 AM
Re: Logging out a user from the command line
Which you can't show here?
> [...] they showed processes [...]
Not to me.
> [...] determine the pid for the user
> session?
Did you look at the parent PID (PPID) for any
of these processes? (If my psychic powers
were stronger, then perhaps I could see what
you see, and that might save us some
back-and-forth. Or, you could show an actual
command with its actual output, instead of
providing only a vague description. Just a
thought.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 07:51 AM
тАО06-23-2010 07:51 AM
Re: Logging out a user from the command line
Get the PID of the process and terminate it.
* Get the pid of the process you want to kill
#who -u
* kill the process
#kill -9
Hope this helps.
Regards,
Murali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 08:32 AM
тАО06-23-2010 08:32 AM
Re: Logging out a user from the command line
I ran the who -u command, and the output is shown below:
root pts/ta Jun 23 12:27 . 29986 w0081861.mgh.harvard.edu
test pts/8 Feb 4 14:32 old 27074 mgh-9044a375d1f.
test pts/10 Feb 4 14:37 old 29875 mgh-9044a375d1f.
The kill command was applied to the processes, 27074 and 29875 associated with the test user account. However both commands resulted in the "No such process" error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 08:35 AM
тАО06-23-2010 08:35 AM
Re: Logging out a user from the command line
> The kill command was applied to the processes, 27074 and 29875 associated with the test user account. However both commands resulted in the "No such process" error message.
Then this is a case of the 'utmp*' file which holds login information being corrupt --- not a "big deal". Things will get cleaned up at the next reboot.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 08:47 AM
тАО06-23-2010 08:47 AM
Re: Logging out a user from the command line
Thanks for the information. We are planning on doing a scheduled reboot of the server in the next couple of weeks, so I will put the matter to rest for now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2010 09:33 AM
тАО06-23-2010 09:33 AM
Re: Logging out a user from the command line
Restart the UTMPD daemon using below commands:
#./sbin/init.d/utmpd stop
#./sbin/init.d/utmpd start
This should remove the invalid user entries.
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2010 02:04 AM
тАО06-27-2010 02:04 AM
Re: Logging out a user from the command line
If you want to log out a user:
1- do a "w" and determine user,
2- under tty column of that user, see what pts?
3- do a "fuser -ku /dev/pts/3" with root if that user is in pts/3.
--arvin--
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2010 11:03 PM
тАО06-27-2010 11:03 PM
Re: Logging out a user from the command line
#who -Hu
You will see something like this
NAME LINE TIME IDLE PID COMMENTS
root console May 17 11:05 old 2105 system console
Now use the pid to kill the session
# kill -9