I’m in a bit of trouble and need to run a linux command as sudo using php. Is this possible using php’s exec()? I’ve tried but cannot enter the sudo password and then execute another command on the same exec() call.
edit: i cannot access the server remotely via ssh due to own stupidity. That’s why i have to run commands thru the web server.
You can grant some privileges for some command to a given user (such as the user that runs your webserver…) with visudo, or have to setsuid the program you want to run, but I strongly disadvise you to do this.
Can’t you use a more secure way, for example writting data in a database, and build a daemon robot that often looks in the database, do achieve the job, and this daemon could be granted as root?