After installing Raspbmc on my Raspberry Pi, I just found out that whenever I plug any USB disk (USB flash disk or external hard disk) with NTFS partition, all files and directories within this partition only accessible by root user. Partition with ext format such as ext3 and ext4 can be mounted normally without any file permissions issue.
Here are sample of my root directory content from my NTFS partition:
It’s not funny whenever I want to access my files, I should switch to root at first. So, after some searching on internet, I found several useful articles which can help me solve this issue.
Raspbmc uses udisks-glue daemon to perform auto mount partition whenever you plug any USB disk. Your USB disk partition will be automatically mounted at /media directory. So, if you have an external hard disk with two partitions, one have label: Movies and another one: Music, these partition will be auto mounted and accessible on /media/Movies/ and /media/Music/ when you plug it.
What I learn from several articles I found on internet is, this udisk-glue daemon is not run as root at start up. Second, user’s permission on NTFS partition is different from ext partition. Since Unix or Raspbmc uses ext partition format, when you plug USB disk with ext3 or ext4 partition, you will be able to read or write to any files or directory within the partition as long as you have the permission (for example you can read and write to any file which belong to you or any file which r and w permission). However this mechanism will not apply to NTFS partition which is not supported natively by Unix. So whenever you plug NTFS partition, Raspbmc will mount the partition using default permission: read and write permission to the owner (for this case the owner is pi user). Other user will not be able to read or write any files within this partition.
So, how to make NTFS partition accessible to other users? First, you need to change default setting on udisk-glue configuration, which can be found on: /etc/udisk-glue.conf. Change dmask and fmask value to “0000” to set all files and directories permission to read, write, and execute which apply to owner, group, and other user. The /etc/udisk-glue.conf should be looked like following:
Second, udisk-glue daemon must be run as root user. To do this, modify /etc/init/udisk-glue.conf. Replace exec su - pi -c “udisks-glue” to exec udisks-glue. So the content of /etc/init/udisk-glue.conf should be looked like following:
You need to be root to modify /etc/udisks-glue.conf and /etc/init/udisks/glue.conf.
After modifying the files, restart your Raspberry Pi to take the effect. Now, whenever you plug any NTFS partition, it will be accessible by other users.