Try to do folowing
write shell script
#!/bin/sh
mount /dev/hdb /home/mountpoint
then write C code
int main(){
system ("mount.sh");
return 0;
}
then compile C code
gcc main.c -o wrapper
then chmod :
# chmod a+s wrapper
and do from php:
system ('wrapper');
Per Jessen пишет:
Mário Gamito wrote:
Hi,
I'm trying to run /bin/mount and /sbin/mount.cifs from a PHP page.
So, I´ve added this to /etc/sudoers:
-------------------------------------------------------------------------
Cmnd_Alias CMD_MOUNT = /bin/mount
Cmnd_Alias CMD_CIFS ) = /sbin/mount.cifs
nobody ALL = NOPASSWD: CMD_MOUNT
nobody ALL = NOPASSWD: CMD_CIFS
-------------------------------------------------------------------------
Problem is that I need to run it from PHP and in this way, it doesn't
mount.
I'm using PHP's exec function:
exec(sudo mount -t cifs ...)
I have the ownership and permissions of the mount point set correctly.
As it is a dynamic application, the mount point always changes
(/mnt/user1, /mnt/user2, etc.), so, /etc/fstab is not an option :(
Any ideas ?
Which user are you running your script with? wwwrun?
/Per Jessen, Zürich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php