Hello forum

How can I get my USB external hard drive to mount as non root? I am using diskdrake to mount it (me being the owner) and this drive has a NTFS file system. The only way I can view the contents of this hard drive is to log on as root, which is a big inconvience.

This drive's folder in /mnt also has a padlock on it and I get a "permission denied" message when I try to access it.

I can, however, access this external USB hard drive as non root by putting "unmask=0022" in the corresponding line in fstab, but when I reboot, HAL and fstab-sync will auto generate a new line in its place, putting me back where I first started. (More about how this feature works can be found by typing "man fstab-sync" in a terminal window). Unmask=0022 allows ordinary users to view the contents of this drive.

I have another USB external hard drive with a fat32 file system and it mounts as non root with no problem.

I have tried using the chmod command, the chown command, and I have tried creating a custom rule using msec (making me the owner) for this hard drive's folder in the mnt directory but none of this worked.

It is my understanding that I can write a custom fdi rule in the /usr/share/hal/fdi/95userpolicy folder to correct this problem but I don't know how to do that.


Can anybody here please help me mount this USB external hard drive (ntfs) as non root? I am using Mandriva 2006.

Any help would be most appreciated.

Roy S. Smith

alc6379 commented: excellent work! +6

Dani AI

Generated

Short summary and practical next steps (grounded in what found, plus safer/modern alternatives).

NTFS volumes do not store POSIX owners/permissions the way ext-family filesystems do — ownership is applied at mount time, so chmod/chown on the mounted NTFS tree will not do what is expected. The usual, reliable fixes are: mount with the FUSE ntfs-3g driver (or the appropriate ntfs kernel driver) and pass explicit uid/gid and mask options so the files appear owned by the desired Linux user. (manpages.ubuntu.com)

If a persistent non-root mount is wanted, a single fstab line is the simplest durable method. Example pattern (replace UUID and UIDs as appropriate):

UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  /media/Backup  ntfs-3g  defaults,uid=1000,gid=1000,fmask=133,dmask=022  0 0

Test first with a manual mount to confirm behavior:

sudo mount -t ntfs-3g -o uid=1000,gid=1000,fmask=133,dmask=022 /dev/sdXN /mnt/test

The ntfs-3g docs show this usage and include sample fstab entries. (github.com)

For the HAL-era automount behavior that Mandriva used, the robust approach is to add a custom HAL policy file (an .fdi rules file) that instructs the automounter to permit and/or supply ntfs-3g mount options rather than editing the shipped policy files (those get overwritten by package updates). The .fdi format can declare the filesystem driver to use and append allowed/default mount options (uid, gid, umask/fmask/dmask). Create a single small .fdi in the system local policy directory rather than modifying distro-supplied files; examples and the policy keys are documented in HAL guides and community examples. (linuxfromscratch.org)

Note about today: HAL and its .fdi mechanism are effectively legacy on modern distributions — udisks2/udev (and systemd mount units) now handle automounting and expose a configuration file for defaults (/etc/udisks2/mount_options.conf). If using a current distro, prefer configuring udisks2 or a systemd mount unit rather than HAL. Also confirm the NTFS volume is clean (Windows not hibernated), and that ntfs-3g is installed before automating. ()

Troubleshooting checklist: ensure ntfs-3g installed; try the manual mount command above; inspect kernel and HAL/udisks logs (journalctl); if automount ignores options, test an explicit fstab entry (UUID-based) to prove the correct options, then move to a policy file or udisks2 config for automation.

Recommended Answers

All 3 Replies

SUPPLIMENT -

In summary, my main desire is to be able to change the owner of this drive from root to myself. If I could do this, I wouldn't have to insert "unmask=0022 in fstab because it would be readable anyway.

If I can't change ownership of this drive to myself instead of root, then I want to be able to insert "unmask=0022" in fstab so that it will stay after a reboot. HAL keeps changing it back.

SUPPLIMENT -

In summary, my main desire is to be able to change the owner of this drive from root to myself. If I could do this, I wouldn't have to insert "unmask=0022 in fstab because it would be readable anyway.

If I can't change ownership of this drive to myself instead of root, then I want to be able to insert "unmask=0022" in fstab so that it will stay after a reboot. HAL keeps changing it back.

Update

I finally fixed my problem and did not have to disable HAL. I simply edited the /usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi file by adding a few lines. I added umask=0022, owner, and user, each with its own line. Now HAL will automatically add these three entries in fstab after each reboot. Now the computer boots up with the problem drive already mounted and accessable as non-root.

They don't recommend editing the storage-policy.fdi file because it will be overwritten by any software updates. You are supposed to create your own custom fdi rule and put it in the /usr/share/hal/fdi/95userpolicy directory. But since I don't know how to write my own custom fdi rule, I just edited the storae-policy.fdi file instead.

I hope this will help anybody else who can not access a USB ntfs external hard drive as non root due to HAL kicking out any changes made in fstab.

PS - I had been spelling umask wrong. I was spelling it unmask when it should have been umask.

Roy S. Smith

Excellent job!

I've never used Mandriva before, so I was unaware of their policies on changing things like fstab entries. What ever happened to just "Keep it Simple, Stupid"? /etc/fstab has worked for years, no need to go mucking about with it now, IMHO.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.