shell_exec();

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

shell_exec();

Post by William »

Dear All,

I was wondering if it was possible to login to root using "su" or another function using shell_exec() or another way? I am trying to kill a process id that I will need root to do.

-Thanks
Last edited by William on Wed Aug 31, 2005 2:30 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Kamari, you are entirely out of line. Being drunk or high is no excuse.

You now have two choices: straighten out, or leave the forums.

This is an official warning.


Note to others: this thread has been cleaned of retarded posts.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you may need to upload a shell script to execute for it, preferrably stored outside the document root ;) But yes, it is possible.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You may be able to use sudo to do it. You'll have to put your PHP user in the sudousers file though, but then you should be able to do something like this:

Code: Select all

sudo kill -9 18876
where '18876' would be the PID of whatever process you need killed.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Thanks for all your help I will have my friend tell me his method when he gets back. Alot of good ideas thanks :). It really isn't that big of a deal just my friend and I where trying to see who could kick echother out of the server faster. So I made a PHP script to get his PID from his IP Address and kick him. But it wasn't killing the process probably because the user wasn't as high as he was. Thanks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

He he. Get that PHP script to run whenever he logs in. Can't get much faster than that.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Yeah that would really make him mad... Hmm... Maby making a bash script to do this would be easier but PHP is more fun.
Post Reply