9

I have a NTFS partition on my PC. It shares data between Linux and a Windows dual boot system.

My /etc/fstab line for that is:

#Mount Dati at boot=
UUID=01CD9E64E80BD460 /mnt/Dati ntfs nls=iso8859-1,umask=0022,uid=1000,gid=1000,dmask=027,fmask=137 0 0

There is something wrong, because I can not make any files executable. What should I change?

In addition, can someone help me understand umask, dmask, and fmask or post a link to some guide?

Summarizing: What permission should I give to a NTFS partition that is shared between Linux and Windows, and shared on samba network?

MadMike
  • 4,275
  • 8
  • 29
  • 50
f.lambe
  • 111

1 Answers1

22

I know this question was asked a while ago, but I will try to answer it anyway for future users:

About mask in file system:

The use of masks in linux filesystem is to control - read, write, and execute permission among different users/groups for specific files and folders. I emphasize the word 'control' because masks are not same as giving permission. Just the opposite; they are to control or limit permission. So, if you want to set 777 for a file as permission, then you have to use 000 as mask for that file. For permission 655, mask will be 122 (i.e: for permission xyz mask will be (777-xyz)).

What is umask,dmask, and fmask?

  • umask = user mask (folder and directory!)
  • dmask = directory only mask
  • fmask = file only mask

How To Set Executable Permission for NTFS Partition files?

Run this command to get UUID (Universally Unique IDentifier) for every NTFS drive:
$ sudo blkid

You will get output like this:

/dev/sda6: LABEL="Software" UUID="FEDC5DB5DC5D6943" TYPE="ntfs" 
/dev/sda7: LABEL="Works" UUID="585AD06A35149024" TYPE="ntfs" 

Now edit the fstab file:

$ sudo vim /etc/fstab

In the fstab file add/edit every drive specifying line with the following options (remember to use other option carefully, as adding any other option may cause problem):

defaults,auto,umask=002 

So after edit/adding nfts drives your portion of fstab file will look something like this:

#<file system>           <mount point>   <type>  <options>                  <dump>  <pass>
UUID=FEDC5DB5DC5D6943   /media/software   ntfs    defaults,auto,umask=002      0      0
UUID=585AD06A35149024   /media/works      ntfs    defaults,auto,umask=002      0      0

Above umask will set permission equal 775, i.e read-write-execute for admin user (that is you) and admin user group and read-write permission for other users. For samba share you might need to use gid=YourGroupID,uid=YourUserID in the option set. You can find YourGroupID and YourUserID values using the following command:

$ id YourUserName

Now Unmount your drives if already mounted:

$ sudo umount -a

Then mount by this command:

$ sudo mount -a

After mount you can use the drives in whatever way you want.

AtariBaby
  • 321
sowrov
  • 323