Mount an NTFS partition on Ubuntu with a specific owner
and group
. (Otherwise it’ll mount it as root
, which makes sharing the fs on samba a bit difficult, you get permission errors when trying to connect from a mac)
NTFS doesn’t support Unix-style ‘owners’, so the Linux kernel is forced to assign an owner for the entire volume - normally, root. As an alternative to moving your entire home directory to EXT4, you could also give ownership of the entire partition to a specific user or group using the ‘uid’ or ‘gid’ options for
mount
(or infstab
).
Find uid
and gid
1# get details for the current user
2id
3# get UID only
4id -u username
5# get GID only
6id -g username
uid=1000(aamnah) gid=1000(aamnah) groups=1000(aamnah),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare),128(kvm),130(libvirt),138(docker)
The uid
and gid
in this case is 1000
Edit your /etc/fstab
entry to add options to the mount command
1sudo nano /etc/fstab
UUID=009AD0155091CC5F /media/aamnah/Files ntfs-3g defaults 0 0
would become
UUID=009AD0155091CC5F /media/aamnah/Files ntfs-3g
defaults,uid=1000,gid=1000,umask=022 0 0
uid=1000
is the user id.gid=1000
is the group id.umask=022
this will set permissions so that the owner has read, write, execute. Group and Others will have read and execute.And then unmount and remount the file system for the changes to take effect (For some reason, this didn’t work when i did it via gparted GUI, but the text commands worked)
1umount /media/Files
2mount /media/Files
You will also have to mount the partitions inside the user’s home directory for them to be allowed access from macOS. This was the last step i had to do in order to get rid of the permission error.
1# unmount the old Files partition
2sudo umount /media/aamnah/Files
3
4#create a new directory mount point
5mkdir -p /home/aamnah/Mounts/Files
6
7# update mount point in /etc/fstab
8sudo nano /etc/fstab
/media/aamnah/Files
would become /home/aamnah/Mounts/Files
1UUID=009AD0155091CC5F /home/aamnah/Mounts/Files ntfs-3g
2defaults,uid=1000,gid=1000 0 0
(i removed the umask
bit to resolve unable to write errors, since all computers on the network are my own i’m not too worried) and now run the mount
command again to mount at the new location
1# unmount the new Files partition
2sudo mount /home/aamnah/Mounts/