Home > other >  /etc/sudoers configuration fail for NAS mount
/etc/sudoers configuration fail for NAS mount

Time:02-10

i have that permission denied problem if i try to create folders to an NAS mounted folder

/etc/fstab

//192.168.0.2/html_web/html    /var/www/html/    cifs  vers=1.0,_netdev,username=.........
//192.168.0.2/html_web/sec     /var/www/sec/     cifs  vers=1.0,_netdev,username=.........

over the

doStuff function

function doStuff( ...$a){ 
  $string = "";
  foreach( $a as $b1 ){ $string .= "$b1 "; }
    shell_exec("sh /var/www/sec/doStuff.sh $string");
 } 

with

doStuff( 'createUserFolder', '/var/www/sec/user_data/', 'folder_1' );

after i tried to set the permission of that mounted sec folder to www-data:root. still root:root after that and also if i try

mkdir /var/www/tmp_sec/user_data

then set to www-data:root for it and set the fstab

 /var/www/sec/user_data     /var/www/tmp_sec/user_data/   none  bind 

still the same problem. i dont know how to solve this without setting /etc/sudoers value to

 www-data ALL=(ALL) NOPASSWD:ALL 

to have access for mv, cp, mkdir or other stuff. and no. i dont want to set cron jobs. thx for help

doStuff.sh

if [ $1 = "createUserFolder" ]
  then
    mkdir $2$3
fi

/etc/sudoers

www-data ALL=NOPASSWD: /var/www/sec/doStuff.sh

CodePudding user response:

  •  Tags:  
  • Related