Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Force logout a user  (Read 2949 times)

0 Members and 1 Guest are viewing this topic.

akhils

  • Guest
Force logout a user
« on: November 07, 2014, 01:02:49 am »
Hi all,  8)

There might be instances where you need to force logout a user from the server, even if may users are logged into the server as root. In such instances, we may use the following method to force logout the user, regardless of the user which needs to be forced being root or a normal user.

>> Use the command below to find the users logged in the server.
=-=-=-=-=
root@cpanel [~]# w
 00:56:18 up 22 days, 12:38,  1 user,  load average: 0.19, 0.10, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    level3.admin-ahe 23:54    0.00s  0.06s  0.00s w
=-=-=-=-=

>> Use the following command to find the process dependent for the tty which needs to be forced to logout.
=-=-=-=-=
root@cpanel [~]# ps -dN|grep pts/0
 324602 pts/0    00:00:00 bash
=-=-=-=-=

>> Now that we have the process ID of the tty which needs to be forced to logout, we may directly kill the
--
Kill command syntax:
kill [signal] PID
kill -15 PID
kill -9 PID
kill -SIGTERM PID
kill [options] -SIGTERM PID
--

=-=-=-=-==-=-=-=-==-=-=-=-==-=-=-=-==-=-=-=-=

Thats all, thank you for your time.. :)

 ::)