2

I'm running a script that needs root privileges. One of its functionality is mounting an attached user HDD by using udisksctl utility. I'm using it like

udisksctl mount -b /dev/sdX --options umask=0000

but when it succeed, it automaticaly mounts it to /media/root/<LABEL>. But since it mounts it in root's directory, a normal user can't use it or unmount it etc.

How can I succeed it? Anything wrong with my umask usage or it is about env variables? (My distro is Ubuntu, I'm using udisksctl for cross-platform issues.)

  • 1
    It's normal that users can't unmount what other users have mounted, doing otherwise would be a major security problem. What do you want to do? Authorize certain users to access and unmount this specific directory? Are there other mount points under /media/root that you'd want to protect? Why are you using udisksctl rather than calling mount directly? – Gilles Aug 19 '15 at 21:47
  • 2
    sudo -u <yourUser> <mountCommand> might work? – Javier Aug 19 '15 at 21:49
  • My mount script is triggered via a root-privileged program. I want to use udisksctl because there is cross-platform issues for udisks and udisks2. mount command always wants a target directory for mounting but udisksctl automatically mounts it under /media/<username>/<labelname> – ozirus Aug 20 '15 at 5:55
  • if there is a user option in /etc/fstab I think a normal user can umount it, otherwise if you can mount in a directory you own then it may simplify things – gwillie Aug 20 '15 at 7:38
0

The idea is you can choose a mountpoint that is accessible. So try:

mount /dev/sdX /target/blablabla -o rw,umask=0000
0

I've solved the issue. In /media/X/<labelname>, X comes from environment variable LOGNAME

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.