I’ve got problem to check and mount disk, because sometimes my unix machine disconnect USB disk, so I want to write script that check last disk and mount it.
But there was a problem to run system command fdisk to return all disks.
So here is solution:
– edit or create file
– insert into file
Defaults env_reset %www-data ALL=(ALL) NOPASSWD: ALL
– exit and save
You also need sudo installed on system !
Now you can execute sudo script with php command exec()
<!--?php $lastLine=exec("sudo fdisk -l",$retVal); ?-->
Have a nice day 🙂