5

Are there any security related risks when mounting with root privileges compared to mounting with regular users?
I have a script which does some ecryptfs mounting with non-root privileges (by design), but it doesn't work as expected on all required Linux systems, so I'm wondering if switching to mounting as root is a good idea.

Any help is greatly appreciated.

ddario
  • 713
  • 1
  • 5
  • 6

1 Answers1

5

Deep down, mounting is performed by root anyway: only root can call the mount system call. Programs such as mount, pmount and fusermount are setuid root and restrict what non-root callers are allowed to mount.

If you're mounting a filesystem that doesn't implement file ownership (e.g. FAT), the user calling mount will end up owning the files (unless overridden by a mount option). Other than that, it doesn't matter who does the mounting.

I'm not saying that mounting as root is the right solution in your scenario. I don't know what your scenario is. But there is no direct security risk in doing the mounting as root as opposed to some other user.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175