Mount NTFS partition at startup, with non-root user as owner
In the options column add permissions
and auto
(and probably user
or users
)
nls=iso8859-1,permissions,users,auto
-
permissions
: (NTFS-3G option) Set standard permissions on created files and use standard access control. -
auto
: Will be mounted at boot and frommount -a
-
user
: Allow an ordinary user to mount the filesystem -
users
: Allow every user to mount and unmount the filesystem
Then change ownership of the filesystem:
sudo chown -R thomas:thomas /media/data
My line in /etc/fstab
/dev/sda5 /media/ntfs ntfs-3g users,permissions,auto 0 0
Mount and list permissions
sudo mount /media/ntfs
Using default user mapping
bodhi@ufbt:~$ ls -l /media
drwxr-xr-x 1 root root 4096 2012-01-04 17:08 ntfs
Change ownership and list new permissions
bodhi@ufbt:~$ sudo chown bodhi:bodhi /media/ntfs
bodhi@ufbt:~$ ls -l /media
drwxr-xr-x 1 bodhi bodhi 4096 2012-01-04 17:10 ntfs
By default, ntfs-3g mounts the partition noexec, nosuid, and nodev.
-
noexec
: Do not allow direct execution of any binaries on the mounted filesystem. -
nosuid
: Do not allow set-user-identifier or set-group-identifier bits to take effect. -
nodev
: Do not interpret character or block special devices on the file system.
To override this and allow executing files, use exec
/dev/sda5 /media/ntfs ntfs-3g exec,permissions,auto 0 0
Now we get
bodhi@ufbt:~$ ls -l /media/ntfs
-rwx------ 1 bodhi bodhi 28 2012-01-04 17:16 file
bodhi@ufbt:~$ /media/ntfs/file
It works
Use the uid
and gid
options (or use the user mapping feature) of mount.ntfs (8)
What about using udisks
? It can easily mount NTFS partitions with your user as owner.
Example (type it into command line):
/usr/bin/udisks --mount /dev/sda3
You can also add that command to startup applications and it will auto-mount when you log-in.
Reference: AutomaticallyMountPartitions
Mine works now perfectly when i change the fstab's line to
UUID=761C84B31C846FC3 /media/d ntfs defaults,umask=022,uid=1000 0 0