About nixCraft

Topics

Howto: Linux kill and logout users

Posted by Vivek Gite [Last updated: November 9, 2006]

Yet another newbie question that suggests people love to kill and show their power to rest of the world ;)

There is a package called procps. It includes various useful (read as nifty) utilities. One of such utility is skill which is responsible to send a signal to users and process such as:

Also note that these are utilities to browse the /proc filesystem, which is not a real file system but a way for the kernel to provide information about the status of entries in its process table.

Task: How to halt/stop user called didi

Type the skill command as follows:
# skill -STOP -u didi

You muse be root to stop other users.

Task: How to resume already halted user called didi

Send CONT single to user didi, type the following command:
# skill -CONT -u didi

Task: How to kill and logout user called didi

You can send KILL single, type the following command:
# skill -KILL -u didi

Task: Kill and logout all users

The ultimate command to kill and logout all users, type the following command:
# skill -KILL -v /dev/pts/*

Please note that send users warning message or logout notice using wall command to avoid data loss.

Other useful nifty utilities provided by procps package

Tell us how we're doing: Please answer a few questions about your experience to help us improve nixCraft.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. max Says:

    This stuff is very cool!
    I manage an iternet cafe linux-based and to log-out users remotely since now I first logged in the client machine via ssh and then export DISPLAY=:0 and kdeinit_shutdown.But doing that I was lucky with kde as default wm, while ’skill -KILL -u user’ is a better one_line command solution and for (I guess) all windows managers.
    What I’m still wondering is: how to login remotely a user assuming that the default login manager is kdm?
    Thanks in advance for any hint.

  2. nixcraft Says:

    Hey max,

    Great to know you are using Linux for your internet cafe.

    skill should works with an wm or shell as it directly sends a signal to user.

    >What I\’m still wondering is: how to login remotely a user assuming that the default login manager is kdm?

    Sorry but I am not getting your question. Can you explain it little more?

  3. max Says:

    >Sorry but I am not getting your question. Can you explain it little more?
    Well, when a customer finish his session is comfortable for me remotely close the session, but when I need to start a new one I need to sit-up from my chair and then go to the client and put the passwd (the user account is setted as default in kdm config) manually in the kdm welcome_login_window.
    Now I’m just wondering how to put remotely the passwd in kdm to open the session again without (being lazy :-]) uprise from my chair?
    I hope this wouldn’t be a too much tricky question an sorry about my english that isn’t my first language @^_^@

  4. nixcraft Says:

    Now, I understand your problem, you do not want go to each PC everytime new customer arrives. You can kill your customers session with skill but now you want to do auto login right from your own admin PC

    Well I do not have exact solution but you can use KDE auto login facility to login the user automatically…

    On the other hand, you may be writing some script, which will log them automatically

    Another solution is kill user using skill
    When new person comes for browsing just tell him to seat in front of computer
    You login from your own admin pc to remote linux desktop system over ssh
    And you type the command startx&
    It will start the session on remove computer
    In order to work this all system must boot to text mode
    SSH should be running on all system
    And autologin must be turned on for all linux system

    Hope this helps

  5. deivs Says:

    how to logout specified user after one hour automatically,how to do ?

  6. nixcraft Says:

    deivs.

    You need to write a script. There is no inbuilt facility available, AFAK

  7. Paul Says:

    Hi,

    I was pleased to see the skill inf have ld sessins n an LTSP server. I have since set a timeout uing TMOUT=7200 in /etc/profile.
    Iuse skill -KILL -u paul to try and remove the old sessions. It succesfully removed one but doesn’t seem to remove the other 2 that are reported by ‘who’. Is it possible that ‘who’ is reprting stale/non-existant sessions?

  8. vivek Says:

    Try to use pkill command
    pkill -KILL -u username

  9. Masood Yarmohammadi Says:

    Hello,
    i use
    skill -KILL -u didi root

    Now, i can’t login to ssh!

  10. Hong@macau Says:

    i think when i enter this command
    skill -KILL -u root

    this will be kill all the process that create by root. such as ssh telnet process.

  11. deivs Says:

    script to logout the users in the specific time

  12. De.. Says:

    i want to delete the process because my systems average load is too high 150.0 and more some time
    and when i delete them ..they goes to and start increasing the load continously..
    the process are perl scripts..
    please help urgent

  13. De.. Says:

    the process hang up and when i shen them it shows like “defunction”

  14. Terry Says:

    Oops didn’t read through all the threads. I had a user who was logged on remotely as root but when I ran the command we were kicked out of our SSH sessions
    Is there any way to recover SSH functionality short of rebooting

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.