2

I know, this question is asked a lot of times. Just searched for several hours, but nothing i did worked.

The thing i want to do is setup a little NAS. As a test i took a memory stick to serve as storage. The memory stick is formatted with a fat32 filesystem. Because fat32 is a windows filesystem it's not compatible with the way of changing permissions the linux way. In the several hours i searched the web i came across many different ways to change the permissions in the mounting process, but not the right one, every time the permissions are 755 for my mounted directory.

my fstab looks like: /dev/something /mnt/something vfat ... 0 0

I tried many things in the option field. At first just defaults, then the write option, also tried fmask, dmask and umask options.

To test if the fstab wasn't the error I also tried mounting with the mount command using the fstab options.

Anybody knows the real solution? Just using NTFS filesystem? Use other mount options?

Jeroen
  • 29
  • I have tried lots of things over the years. And I used to have quite an Anti-Anything Windows stance. BUT I am less that way now. I think that NTFS is very fast and works nicely with Linux. – walttheboss Jun 15 '20 at 01:12

2 Answers2

1

Why does a FAT file system work differently

FAT, FAT32 and exFAT are file systems designed for file transfer and multiple system compatibility. They don't take into account user privileges or permissions. That makes them very useful for things like USB memory drives as they can be moved from one computer to another.

That said a mounted partition in a Linux system is expected to be part of the OS and therefore security permissions have to be added to the mounting command (or configuration at the fstab file).

How to add permission configuration

The secret to adding permissions is using a mask in the mounting command/configuration.

As @Panther had mention before, using the options dmask (directory mask) and fmask (file mask).

/dev/something /mnt/something  noauto,users,uid=1000,gid=1000,dmask=0000,fmask=0001,utf8  0  0

Unlike Panther's recomendation, I assinged fmask=0001 to avoid any random user from executing any file in those directories.

You can read more about mask permissions in this other answer.

Create a custom user / group for the NAS share

I would also suggest creating a user and group (at least a group) to specify who may actually access and edit this content.

Good luck.

Torrien
  • 835
1

If you use the flash drive with LINUX ONLY, I suggest you reformat and use ext2 or ext4.

If you use it with Windows, you ccan use fat, use this entry in fstab

/dev/something  /mnt/something  noauto,users,uid=1000,gid=100,dmask=0000,fmask=0000,utf8  0  0

you can change the uid or gid if you wish.

Panther
  • 102,067