Thursday, January 16, 2014

NTFS permissions and mounting (Ubuntu 12.04)

We have a workstation with multiple hard drives formatted with ntfs file systems to allow them to play nicely with Windows. Those file systems gave me issues when trying to allow multiple users to access them from Ubuntu.

Mounting from nautilus only allowed the current user to access it, and I don't think that the ntfs file system can have its permissions changed via chmod or chgrp after it has been mounted. What ended up working (for the most part) was suggested here. In this solution, the file system is mounted with the designated permissions using mount's fmask and dmask options for an ntfs file system.

First I needed to add the necessary users to a group that could access the drives; here I added them to the existing group plugdev
id username

sudo usermod -a -G plugdev username

id username
I made a directory in /media to hold the file system:
sudo mkdir /media/DATAPART1
And then I mounted the drive, which was at /dev/sdb1 (which I located using gParted). In this case, plugdev is group id 46, and this gives full permissions to the user and group (which becomes root and plugdev, respectively).
sudo mount -t ntfs -o gid=46,fmask=0003,dmask=0002 /dev/sdb1 /media/DATAPART1
Unfortunately, I couldn't work out how to execute a file on the mounted file system without giving execution permissions on ALL files; thus every non-directory file ends up the color of an executable with this method. I also couldn't work out how to enable the sticky bit for files to protect one user's files from being deleted by another user.

Sources:
https://help.ubuntu.com/community/InstallingANewHardDrive
http://www.cyberciti.biz/faq/ubuntu-add-user-to-group/
http://askubuntu.com/questions/11840/how-to-chmod-on-an-ntfs-or-fat32-partition
http://linux.die.net/man/8/mount
http://en.wikipedia.org/wiki/File_system_permissions
http://en.wikipedia.org/wiki/Chmod
http://en.wikipedia.org/wiki/Umask
http://ubuntuforums.org/showthread.php?t=1453342
http://unix.stackexchange.com/questions/110256/cant-apply-chmod-to-a-file/110300#110300

No comments:

Post a Comment