How do I change permissions and ownership of files on NTFS partitions (chown command fails)?

Asked by Daniel

The partition is mounted with ntfs-3g (I think -- something like that) and I can create files, as well as edit the majority of files on the partition. However, for certain files I do not have write permission. The owner and group of the files are "root". I attempted to use chown to change the ownership to my own user account. chown does not change ownership or the group; the command does nothing at all.

Attached is the log from #ubuntu at irc.ubuntu.com (and miscellaneous comments) as it refers to this bug.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu ntfs-3g Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #247940.

Revision history for this message
Daniel (daniel-danielbridges) said :
#1
Revision history for this message
Chris Coulson (chrisccoulson) said :
#2

Thank you for taking the time to report this issue and helping to make Ubuntu better. Examining the information you have given us, this does not appear to be a valid bug so we are closing it. However, because I can probably help you with the problem you're having, I'm going to convert your report to a question in the support tracker, as the solution may benefit other users with your problem.

The support tracker can be found at https://answers.launchpad.net/ubuntu

Revision history for this message
Chris Coulson (chrisccoulson) said :
#3

The problem you're having is because NTFS partitions don't understand Linux filesystem permissions and ownership. Because of this, you can't use chown, chmod or chgrp to alter permissions and ownership of files and folders on NTFS partitions.

File and folder permissions on NTFS partitions are determined by mount-time options. The options of interest when mounting a NTFS partition are 'umask', 'uid' and 'gid'. As an example use of these options, I'll quote an entry from my fstab, which I use to mount a NTFS partition:

"UUID=B080F3DA80F3A54E /mnt/winxp ntfs-3g defaults,locale=en_GB.UTF-8,uid=0,gid=1008,umask=0002 0 0"

You can see that I have specified the following options: "uid=0,gid=1008,umask=0002".

What this means, is that all the files within /mnt/winxp belong to user 0 (root), group 1008 (which is a group called 'xp-write' on my system) and have permissions of 775 (which is determined by the umask of 0002)

Hope that helps

Revision history for this message
Doug (douglasblackusa-b) said :
#4

Chris how can I take ownership of my NTFS Drive.

Revision history for this message
Doug (douglasblackusa-b) said :
#5

douglas@douglas-Satellite-A105:~$ sudo fdisk -l; lsb_release -a; uname -a
[sudo] password for douglas:

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders, total 195371568 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ebfed

   Device Boot Start End Blocks Id System
/dev/sda1 * 2048 193294335 96646144 83 Linux
/dev/sda2 193296382 195371007 1037313 5 Extended
/dev/sda5 193296384 195371007 1037312 82 Linux swap / Solaris

Disk /dev/sdb: 1500.3 GB, 1500301908992 bytes
255 heads, 63 sectors/track, 182401 cylinders, total 2930277166 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5a4e52e5

   Device Boot Start End Blocks Id System
/dev/sdb1 * 63 2930276351 1465138144+ 7 HPFS/NTFS/exFAT

Disk /dev/sdc: 8004 MB, 8004304896 bytes
19 heads, 5 sectors/track, 164562 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000de021

   Device Boot Start End Blocks Id System
/dev/sdc1 2048 15632383 7815168 b W95 FAT32
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric
Linux douglas-Satellite-A105 3.0.0-19-generic #33-Ubuntu SMP Thu Apr 19 19:05:57 UTC 2012 i686 i686 i386 GNU/Linux
douglas@douglas-Satellite-A105:~$

Revision history for this message
Doug (douglasblackusa-b) said :
#6

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">

<!-- file created by ntfs-config -->
<!-- mount ntfs volume with the ntfs-3g driver to enable write support -->

    <device>
        <match key="volume.fstype" string="ntfs">
      <match key="@block.storage_device:storage.hotpluggable" bool="true">
       <merge key="volume.fstype" type="string">ntfs-3g</merge>
                <merge key="volume.policy.mount_filesystem" type="string">ntfs-3g</merge>
       <append key="volume.mount.valid_options" type="strlist">locale=</append>
         </match>
     </match>
    </device>

</deviceinfo>

20-ntfs-config-write-policy.fdi

can I change this file to gain ownership of my NTFS drive

Revision history for this message
Doug (douglasblackusa-b) said :
#7

douglas@douglas-Satellite-A105:~$ sudo mount ; cat /etc/fstab ; id
[sudo] password for douglas:
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sdb1 on /media/FreeAgent type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/douglas/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=douglas)
/dev/sdc1 on /media/scandisk type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>

proc /proc proc nodev,noexec,nosuid 0 0
#Entry for /dev/sda1 :
UUID=42798daa-5b5b-425c-bd8a-111d25f92736 / ext4 errors=remount-ro 0 1
#Entry for /dev/sdb1 :
UUID=5288BFD688BFB737 /media/FreeAgent ntfs-3g defaults,nosuid,nodev,locale=en_US.UTF-8 0 0
#Entry for /dev/sda5 :
UUID=6a29db4b-5b2c-403b-a40b-4698379876e9 none swap sw 0 0

uid=1000(douglas) gid=1000(douglas) groups=1000(douglas),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare)
douglas@douglas-Satellite-A105:~$

Can you help with this problem?

Provide an answer of your own, or ask Daniel for more information if necessary.

To post a message you must log in.