Linux - Killing all processes for a specific user

13. July 2012 08:00

 

Here is a few methods for killing tasks for a specific user in linux which may be required during account deletion or because somebody has managed to be an idiot and locked himself out with a fork bomb or some such.

 

The simple method is to use the utility called 'slay' which for debian / unbuntu and most other distrobutions is avilable if its not install you can install it using 'apt-get install slay'

 

It is very simple to use. Just running the command slay <username> and it will kill all of that users processes.

 

 

The other method to use when slay is not avilable is a combination of ps and kill. You can use the following command

 

 

kill -TERM `ps h --User nobody -o pid`

 

 

Understanding the above can other advantages as well because you can switch out the --User for --Group and kill processes by group id as well as for a specific user.

E-mail Kick it! DZone it! del.icio.us Permalink


Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading