Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Making NTFS on usb-storage user readable using HAL
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
pmjdebruijn
Guru
Guru


Joined: 24 Jul 2003
Posts: 506
Location: Sittard, The Netherlands

PostPosted: Mon Aug 08, 2005 12:44 pm    Post subject: Making NTFS on usb-storage user readable using HAL Reply with quote

Hi,

If you own a large usb mass storage device which needs to be writable on Windows, NTFS is basically your only option for a file system. And when connecting such a device to a Linux machine, HAL mounts the drive, but NTFS does not allow users to read it's files by default. This is because of a default umask...

We can make HAL use another umask... In this tutorial I'm using sys-apps/hal-0.4.7-r2.

Open /usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi in your favorite text editor while being root. Then locate the following lines:

Code:

          <!-- Use UTF-8 charset for vfat -->
          <match key="volume.fstype" string="vfat">
            <merge key="volume.policy.mount_option.utf8" type="bool">true</merge>
          </match>



Below them, add these lines:

Code:

          <!-- Allow unpriviledged users to access NTFS drives -->
          <match key="volume.fstype" string="ntfs">
            <merge key="volume.policy.mount_option.umask=000" type="bool">true</merge>
          </match>



Now, your NTFS drives will be readable for use by an unpriviledged user.

Good luck,
Pascal de Bruijn

(Wheee my 500th post...)
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4734
Location: Angra do Heroísmo (PT)

PostPosted: Tue Aug 09, 2005 1:30 am    Post subject: Reply with quote

Hi.

Interesting post. I haven't tried your solution and will thus not comment on its merits. I just want to tell anyone reading this thread, that this issue can be easily solved by using the proper umask,uid and or gid in /etc/fstab.
If I want the user superfriend to read and write the disk, all users from the friends group to read the disk and everyone else to don't read it, I can just add to /etc/fstab the following
Code:
/dev/diskpart /mnt/diskdir ntfs noauto,user,uid=superfriend,gid=friends,umask=037 0 0

_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
pmjdebruijn
Guru
Guru


Joined: 24 Jul 2003
Posts: 506
Location: Sittard, The Netherlands

PostPosted: Tue Aug 09, 2005 6:15 pm    Post subject: Reply with quote

Noooo... that's isn't my point...

By adding something to the fstab... ntfs is readable for exactly one drive which needs to be manually mounted...

My solution works for all usb-mass-storage devices, without additional changes... No need to modify your fstab (as root)...

fstab is situation specific... hal isn't...

Regards,
Pascal de Bruijn
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4734
Location: Angra do Heroísmo (PT)

PostPosted: Tue Aug 09, 2005 6:21 pm    Post subject: Reply with quote

OK, I hadn't realized that.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
iormungand
n00b
n00b


Joined: 02 May 2005
Posts: 25
Location: Brindisi, Italy

PostPosted: Tue Aug 09, 2005 7:59 pm    Post subject: Reply with quote

Hi,
it's possible to define "userpolicies", without editing the default config files (these will be overwritten by updates of hal).

I have created the file storage-policy-pers.fdi:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">

  <!-- Mount external ntfs drives with user privileges -->
  <device>
    <match key="block.is_volume" bool="true">
     <match key="volume.fsusage" string="filesystem">
      <match key="@block.storage_device:storage.no_partitions_hint" bool="false">
       <match key="volume.partition.msdos_part_table_type" exists="true">
        <match key="volume.partition.msdos_part_table_type" int="0x07">
              <merge key="volume.policy.mount_option.uid=1000" type="bool">true</merge>
        </match>
       </match>
      </match>
     </match>
    </match>
  </device>
</deviceinfo>


and put it in /usr/share/hal/fdi/95userpolicy/

Works fine!
Back to top
View user's profile Send private message
pmjdebruijn
Guru
Guru


Joined: 24 Jul 2003
Posts: 506
Location: Sittard, The Netherlands

PostPosted: Wed Aug 10, 2005 7:35 pm    Post subject: Reply with quote

Hmmm, cool...

That seems like a better solution...

Regards,
Pascal de Bruijn
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum