Re: Running mount from PHP

From: Date: Wed, 09 Jul 2008 15:19:38 +0000
Subject: Re: Running mount from PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-276502@lists.php.net to get a copy of this message
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


« previous php.general (#276502) next »