0

Intial question: https://stackoverflow.com/questions/19598201/umounting-through-exec-with-sudo-the-user-is-a-sudoer-with-nopasswd

Basically, I have a PHP script, that:

exec('sudo mount /dev/md/stone:supershare /mnt/supershare');

It completes with no error, exit code 0.

From a separate root session, I cat /proc/mounts and it shows no signs of my supsershare.

Attempt with root to rm -r /mnt/supershare:

[root@stone mnt]# rm -r supershare/
rm: cannot remove ‘supershare/’: Device or resource busy

Attempt with root to umount /mnt/supershare:

[root@stone mnt]# umount /mnt/supershare
umount: /mnt/supershare: not mounted

Attempt with root to mdadm --stop /dev/md/stone:supershare:

[root@stone mnt]# mdadm --stop /dev/md/stone\:supershare
mdadm: Cannot get exclusive access to /dev/md/stone:supershare:Perhaps a running process, mounted filesystem or active volume group?

Any attempts to perform the same commands with sudo from webserver are successful (they show signs of mountpoint, they unmount the devices, stop the raids etc.).

And, yes, I am root:

[root@stone mnt]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),19(log)

How come root does not get notified about the mounts performed by webserver?
In what scenarios does mount become local to effective user?

1 Answer 1

1

In short, the hassle has been resolved.

It was the Apache's corresponding systemd service, that had PrivateTmp=true directive. Apparently, the directive executes the process with a new file system namespace.

You can learn more about adventures to resolving the issue, here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.