How do I terminate a user session using loginctl on redhat?



  • Also see:
    systemd-logind.service(8), systemd-logind(8) - Login manager
    What is the purpose of the systemd-logind daemon?

    This kills all processes for a user session and deallocates the resources.

    First list the sessions and obtain the session ID.

    $ loginctl list-sessions
    SESSION  UID USER     SEAT  TTY
          2 1000 training seat0 tty2
          5 1000 training
         c1   42 gdm      seat0 tty1
    
    3 sessions listed.
    
           terminate-session ID...
               Terminates a session. This kills all processes of the session and
               deallocates all resources attached to the session.
    

    Compared to kill-session

           kill-session ID...
               Send a signal to one or more processes of the session. Use
               --kill-who= to select which process to kill. Use --signal= to
               select the signal to send.
    

    Terminate a user session.

    $ loginctl terminate-session 5
    

Log in to reply
 

© Lightnetics 2024