开发者

kill users processes in linux with php

I am trying to write a php script to kill users in a redhat machine.

I know it is possible (and very insecure) to give apache the ability to do things as root, but I need to be able to kill any user from a web page, does anyone have any good working scripts or point me to a place to find some more info? I can use this code (which I took from php.net) to make it work, but I assume that this will work only if I give apache root permission or run apache as root.

<?php
    exec("kill -9 $pid");
?>

This command pulls the user and their process id which I assume once t开发者_Go百科he apache issue is figured out will work just fine for grabbing the list of users for me to output.

who -u | awk '{print $1" "$7}'

I can't really think of any other info I can give on this, so let me know if I am forgetting anything.


Use the skill command instead:

skill -9 -u username
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜