Operating System - HP-UX
1834814 Members
2670 Online
110070 Solutions
New Discussion

Re: who to disconnect user session

 
Amit Dixit_2
Regular Advisor

who to disconnect user session

Hi,
I am having list of users connected to the
system, and I want to kill their session
but if I do ps it doesnt lists their sh
PID is there any command through which I can
kill their login session MIGHT BE USEFULL
WHEN SOMEBODY LOGINS AS ROOT FROM NETWORK

Thanks,
Amit
4 REPLIES 4
lawrenzo
Trusted Contributor

Re: who to disconnect user session

try

#ps -ef

the seond field is the PID
hello
Victor Fridyev
Honored Contributor

Re: who to disconnect user session

Hi,

I'm not sure that you must be so severe with your users 8 ))).
In any case, the command
who -T
if you run it as root gives you PID of parent users' shell.
You can cneck the last field of the output, which gives the terminal of the session.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Muthukumar_5
Honored Contributor

Re: who to disconnect user session

You can collect users informations and terminal with who -Ru

Collect the terminal informations using ps as
ps -t

It will list out process related to that user login

kill -9

That is all.

-- Muthu --
Easy to suggest when don't know about the problem!

Re: who to disconnect user session

Hi Amit,

Use "who" command to find out list of users logged in then you can list the process owned by the user with the following command
#ps -eaf|grep amit
here amit is the user. Then you can kill all the process for the related user. If any user logged in thought network the see the tty for that user and againg list the process and kill those process. In case of root you can distiguish by the tty. This way you can kill all the logged in users and their process. In case

Gaurav