FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu Jun 24, 2021 21:11



Post new topic Reply to topic  [ 3 posts ] 
Auto mounting NTFS partition with working permissions 
Author Message

Joined: Wed Jan 07, 2015 12:43
Posts: 2
Post Auto mounting NTFS partition with working permissions
I am mounting a Windows 7 Home Premium 64-bit system partition on my Ubuntu 14.04.1 LTS 64-bit installation in order to be able to share data between the two OSs. The problem is that although I explicitly give the option permissions in /etc/fstab file I cannot chmod the files or directories inside the mounted drive. I also experimented with it and noticed if I only supplied permissions option while mounting it and changed into the mount directory I noticed that everything had chmod 777 permissions, but I was able to alter the permission via the chmod command. The working command is as follows in the command prompt:


Code:
mount -t ntfs-3g -o permissions /dev/sda5 /mnt/DATA/


However, I noticed even when I supplied my uid and gid to own the files the option permissions stopped having an effect. I tried appending and prepending it into the list of options just to make sure, and it turned out that in both cases I was not able to alter the permissions with chmod. The codes I used in command prompt is as follows:


Code:
sudo mount -t ntfs-3g -o uid=1000,gid=1000,permissions /dev/sda5 /mnt/DATA/


After unmounting, one more try as follows:


Code:
sudo mount -t ntfs-3g -o permissions,uid=1000,gid=1000 /dev/sda5 /mnt/DATA/


Both of these configurations did not allow me to change the settings and the option **permissions** had literally no effect. In my **/etc/fstab** file I define the line for mounting the **NTFS** partition as follows:


Code:
# data was on /dev/sda5 always
    UUID=01CCA0086DD8A980   /mnt/DATA                 ntfs  auto,users,uid=1000,gid=1000,dmask=022,fmask=133,permissions       0       0



How can I make permissions options work so that I can change the permissions on the go without having to remount the partition totally? I read on askubuntu it as possible, but I am unsure of how to do it. I would greatly appreciate any comments suggestions on this issue. My full /etc/fstab is as follows:


Code:
# /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda6 during installation
    UUID=c6cc14c0-aa75-4660-9e45-10a8fadedb64 /               ext4    errors=remount-ro 0       1
    # /home was on /dev/sda8 during installation
    UUID=30c60dd5-3c79-4e36-8ed7-d8035422f0b6 /home           ext4    defaults        0       2
    # swap was on /dev/sda7 during installation
    UUID=ffbc51d4-25b3-413f-aed1-14eba0f769c7 none            swap    sw              0       0
    # data was on /dev/sda5 always
    UUID=01CCA0086DD8A980   /mnt/DATA                 ntfs  auto,users,uid=1000,gid=1000,dmask=022,fmask=133,permissions       0       0


Do you suggest any other filesystem to use for sharing data between Windows and Linux? I already asked it on askubuntu and ubuntuforums where they pointed out here.

Thanks in advance

P.S:Please note that this is a separate partition only filled with data files such as pictures, videos, program executables, source codes etc.


Wed Jan 07, 2015 12:58
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Auto mounting NTFS partition with working permissions
Hi,

Quote:
I was able to alter the permission via the chmod command. The working command is as follows in the command prompt:
Code:
mount -t ntfs-3g -o permissions /dev/sda5 /mnt/DATA/

Just note that if you did not define any user mapping, the owner of files created on Linux are different from the owners of files created by Windows.
Quote:
However, I noticed even when I supplied my uid and gid to own the files the option permissions stopped having an effect. I tried appending and prepending it into the list of options just to make sure, and it turned out that in both cases I was not able to alter the permissions with chmod. The codes I used in command prompt is as follows:
Quote:
sudo mount -t ntfs-3g -o uid=1000,gid=1000,permissions /dev/sda5 /mnt/DATA/

Forcing uid and gid is obviously incompatible with defining ownership as the creator of files, and as permissions refers to owner and group of files, forcing uid and gid take priority over the permissions options (see http://www.tuxera.com/community/ntfs-3g ... s/#options).

Also note that when you force uid and gid, no ownership or permission information is saved to storage. The owner and group just look like being set as indicated, and the permissions look like allowed by dmask and fmask options. Any settings of permissions will be lost upon reboot.
Quote:
How can I make permissions options work so that I can change the permissions on the go without having to remount the partition totally? I read on askubuntu it as possible, but I am unsure of how to do it.

When relying on automatic mounting, you have no control on options uid, gid, umask and dmask being forced by udev.
You have to define a user mapping file, which will take priority over a few mount options. This file is located by default in .NTFS-3G/UserMapping from the root of the ntfs file system (so in /mnt/DATA/.NTFS-3G/UserMapping). The minimal contents of this file is a single line as follows :
Code:
::S-1-5-21-3141592653-589793238-462643383-10000

With this single line you will get the same behavior as when you mount with option permissions and no uid or gid.

However, if you want Windows and Linux to create files with the same owner, you need to customize the user mapping file. Please read the documentation referenced above, and if you have difficulties, please create a sample file by Windows, then switch back to Linux and post the output of :
Code:
ntfs-3g.secaudit -u your-sample-file


Regards

Jean-Pierre


Wed Jan 07, 2015 15:25
Profile

Joined: Wed Jan 07, 2015 12:43
Posts: 2
Post Re: Auto mounting NTFS partition with working permissions
Thanks for the through explanation so as far as I understood I need to define a User Mapping File which maps users in Windows to users in Linux. I will try probably in the weeked(I have lots of tasks at the moment) and ask for assistance if needed.

jpa wrote:
Hi,

Quote:
I was able to alter the permission via the chmod command. The working command is as follows in the command prompt:
Code:
mount -t ntfs-3g -o permissions /dev/sda5 /mnt/DATA/

Just note that if you did not define any user mapping, the owner of files created on Linux are different from the owners of files created by Windows.
Quote:
However, I noticed even when I supplied my uid and gid to own the files the option permissions stopped having an effect. I tried appending and prepending it into the list of options just to make sure, and it turned out that in both cases I was not able to alter the permissions with chmod. The codes I used in command prompt is as follows:
Quote:
sudo mount -t ntfs-3g -o uid=1000,gid=1000,permissions /dev/sda5 /mnt/DATA/

Forcing uid and gid is obviously incompatible with defining ownership as the creator of files, and as permissions refers to owner and group of files, forcing uid and gid take priority over the permissions options (see http://www.tuxera.com/community/ntfs-3g ... s/#options).

Also note that when you force uid and gid, no ownership or permission information is saved to storage. The owner and group just look like being set as indicated, and the permissions look like allowed by dmask and fmask options. Any settings of permissions will be lost upon reboot.
Quote:
How can I make permissions options work so that I can change the permissions on the go without having to remount the partition totally? I read on askubuntu it as possible, but I am unsure of how to do it.

When relying on automatic mounting, you have no control on options uid, gid, umask and dmask being forced by udev.
You have to define a user mapping file, which will take priority over a few mount options. This file is located by default in .NTFS-3G/UserMapping from the root of the ntfs file system (so in /mnt/DATA/.NTFS-3G/UserMapping). The minimal contents of this file is a single line as follows :
Code:
::S-1-5-21-3141592653-589793238-462643383-10000

With this single line you will get the same behavior as when you mount with option permissions and no uid or gid.

However, if you want Windows and Linux to create files with the same owner, you need to customize the user mapping file. Please read the documentation referenced above, and if you have difficulties, please create a sample file by Windows, then switch back to Linux and post the output of :
Code:
ntfs-3g.secaudit -u your-sample-file


Regards

Jean-Pierre


Wed Jan 07, 2015 22:56
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.