0

Set usermap.

sudo ntfsusermap /dev/sdb2
#assign user as www-data
#assign group as www-data

Mount ntfs partition /dev/sdb2 with /mnt/winntfs.

sudo ntfs-3g -o permissions  /dev/sdb2  /mnt/winntfs

Now i can use chmod for directory in /mnt/winntfs.

sudo chmod -R 755 /mnt/winntfs/mydoc
ls -al   /mnt/winntfs/mydoc
total 38
drwxr-xr-x 1 www-data www-data 4096 Aug 17 20:03 .
drwxrwxrwx 1 root     root     4096 Aug 17 20:03 ..
drwxr-xr-x 1 www-data www-data 4096 Aug 17 20:03 analyse

I want to make the mount configure in /etc/fstab.

sudo blkid | grep sdb2
/dev/sdb2: LABEL="winntfs" UUID="284A29774A2942C4" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="292c184b-766f-4036-8fa0-5bcd936b85c2
sudo vim  /etc/fstab
UUID=284A29774A2942C4   /mnt/winntfs  ntfs-3g rw ,auto , umask=0022 ,permissions 0 0

Reboot and enter into my os,

ls -al  /mnt/winntfs/mydoc
total 38
drwxrwxrwx 1 root root 4096 Aug 17 20:03 .
drwxrwxrwx 1 root root 4096 Aug 17 20:03 ..
drwxrwxrwx 1 root root 4096 Aug 17 20:03 analyse
sudo chmod -R 755  /mnt/winntfs/mydoc
ls -al  /mnt/winntfs/mydoc
total 38
drwxrwxrwx 1 root root 4096 Aug 17 20:03 .
drwxrwxrwx 1 root root 4096 Aug 17 20:03 ..
drwxrwxrwx 1 root root 4096 Aug 17 20:03 analyse

The fact is that to set permissions and umask=0022 in /etc/fstab can't use chmod,how to write proper /etc/fstab to make chmod to be used after reboot?

1 Answer 1

0

Don't put so many random spaces in your fstab:

UUID=284A29774A2942C4   /mnt/winntfs  ntfs-3g rw,auto,umask=0022,permissions  0 0

Fstab entries are six whitespace-separated fields, which means they cannot have any whitespace internally. Whether it's the device name or the directory path or the options list, you cannot have spaces or tabs in the value because that separates it into multiple fields.

3
  • The setting can use chmod ,instead of chown ,why chown can't be used with the setting line?
    – showkey
    Commented Aug 18, 2020 at 1:48
  • UUID=284A29774A2942C4 /mnt/winntfs ntfs-3g rw,auto,permissions 0 0
    – showkey
    Commented Aug 18, 2020 at 1:53
  • The above setting can make both chmod and chown take effect.
    – showkey
    Commented Aug 18, 2020 at 1:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .