杀死用户进程与PHP的Linux [英] kill users processes in linux with php

查看:244
本文介绍了杀死用户进程与PHP的Linux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一个PHP脚本来杀死用户在红帽的机器。

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

我知道这是可能的(而且很不安全)给阿帕奇做的事情为根的能力,但我需要能够杀死从网页的任何用户,没有任何人有任何良好的工作脚本或指向我找一些更多信息的地方吗?我可以用这code(这是我从php.net了),使其工作,但我认为,这将只工作,如果我给Apache的root权限或运行Apache作为根。

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");
?>

这个命令拉我假设一旦apache的问题想通了用户和进程ID将工作只是罚款抓住用户的名单给我的输出。

This command pulls the user and their process id which I assume once the 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.

推荐答案

使用技能命令:

skill -9 -u username

这篇关于杀死用户进程与PHP的Linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆