Linux: How to logout a user

A user was logged in via XRDP and the screen locked.  Each attempt to logon also resulted in a locked screen.  Rebooting is not an option.  There needed to be a way to identify the user and forcibly log them off, and there is.

Logged on as root and typing the who command lists users and logons.  A great working response is to use ps to identify the user, for example pts/1 (it may be some other value pts/2, pts/3, etc.)  Then use the kill command to kill the process that was identified with the ps command.

Caution: While this is an effective method, I have read that this should not be done for the root user.  Closing out the incorrect root user may result in unexpected bad behavior of the system.

ps -dN | grep pts/1
kill -9 

Source

  • https://superuser.com/questions/358835/force-logout-a-user?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa