LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 11-22-2005, 03:25 AM   #1
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Rep: Reputation: 34
Can't change root ownership of NTFS USB hard drive


Hello forum,

It was suggested that I move this post from the newbee section to the Mandriva section in hopes for a better response, so here it is.

After performing a clean install of Mandriva 2006 on a freshly formated partition, one of my USB hard drives (NTFS) has a padlock on its folder meaning that root is the owner of the drive, so I can't view the contents of this hard drive unless I su it or log in the desktop as root. The other USB hard drive (fat32) has no padlock on its folder so I am able to view its contents with no problem. Both of these USB hard drives are mounted in the mnt directory, along with my other devices.

Everytime I make a change in fstab, such as adding unmask 222, it always reverts back to its original state upon reboot. In other words, any changes I make in fstab will not stick. And I am sure I am saving the changes.

I have tried the chmod command in the terminal window, (su) (chmod +rxw, etc.), I get a message saying it can't change the attributes of this folder because it is a read only file system.

I have also tried to change ownership from root to myself (roy) by creating a custom rule in msec for this drive, which is supposed to override the system settings, but it does not remove the padlock from this NTFS USB hard drive.

So, that is the problem - the owner of this NTFS USB hard drive is root and I can't seem to change the owner to myself. If I could change the owner to myself, I'm sure I could then view the contents of this USB hard drive.

I was once able to view the contents of this same NTFS USB hard drive in Mandriva 10.1 (no padlock on the folder) but not Mandriva 2006.

Is anyone in this forum savvy enough to give me a clue as what to do?

Any help would be greatly appreciated,

Roy S. Smith
===================================================================

My fstab file looks like this:

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/hda1 / ext2 defaults 1 1
/dev/hdb5 /home/roy/secondHD ntfs umask=0,nls=iso8859-1,ro 0 0
/dev/hdc /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
/dev/hdd /mnt/cdrom2 auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=iso8859-1,sync,codepage=850 0 0
/dev/hda2 /mnt/win_c ntfs umask=0,nls=iso8859-1,ro 0 0
none /proc proc defaults 0 0
/dev/sdd5 /mnt/USB_HD_80 vfat pamconsole,exec,noauto,codepage=850,iocharset=iso8859-1,managed 0 0
/dev/sdc5 /mnt/USB_HD_250 ntfs pamconsole,exec,noauto,utf8,iocharset=iso8859-1,managed 0 0
/dev/sda1 /mnt/LEXAR_MEDIA vfat pamconsole,exec,noauto,noatime,codepage=850,iocharset=iso8859-1,managed 0 0

And mtab looks like this:

/dev/hda1 / ext2 rw 0 0
none /proc proc rw 0 0
none /proc/bus/usb usbfs rw 0 0
none /sys sysfs rw 0 0
/dev/hdb5 /home/roy/secondHD ntfs ro,umask=0,nls=iso8859-1 0 0
none /mnt/floppy supermount rw,sync,dev=/dev/fd0,fs=ext2:vfat,-- 0 0
/dev/hda2 /mnt/win_c ntfs ro,umask=0,nls=iso8859-1 0 0
/dev/sda1 /mnt/LEXAR_MEDIA vfat rw,nosuid,nodev,noatime,codepage=850,iocharset=iso8859-1,user=roy 0 0
/dev/sdc5 /mnt/USB_HD_250 ntfs rw,nosuid,nodev,utf8,iocharset=iso8859-1,user=roy 0 0
/dev/sdd5 /mnt/USB_HD_80 vfat rw,nosuid,nodev,codepage=850,iocharset=iso8859-1,user=roy 0 0

=====================================================================


The problem drive is in the next to the last line, /dev/sdc5. The mtab file has me (roy) as the owner, not root, but in the properties / permissions of the device, it shows root as being the owner.

======================================================================

If you type "man fstab-sync" in a terminal window (the first line in fstab), this is what you get in part:

fstab-sync(8) fstab-sync(8)

NAME
fstab-sync - Update the /etc/fstab file in response to HAL events

SYNOPSIS
fstab-sync [-cv?] [-a|--add UDI] [-r|--remove UDI] [-c|--clean]
[-v|--verbose] [-?|--help] [--usage]

DESCRIPTION
This program serves one major purpose: Update the file systems table
file /etc/fstab and create/remove mount points in /media in response to
HAL events. This program is usually never run directly from a shell;
instead it is invoked as a callout from the /etc/hal/device.d directory
by the HAL daemon.

DISABLING FSTAB-SYNC
Automatic updates of the /etc/fstab file by the fstab-sync program from
the HAL daemon can be disabled by changing the 50-fstab-sync.hal sym-
link in /etc/hal/device.d directory to point to /bin/false

====================================================================

It looks like if I disable FSTAB-SYNC, any changes made to fstab will not be removed during a reboot. But I would rather not disable it if I don't have to.

Any suggestions? Any help would be greatly appreciated.

Last edited by rrrssssss; 11-22-2005 at 03:52 AM.
 
Old 11-22-2005, 08:42 AM   #2
sam.pedraglio
Member
 
Registered: Jul 2005
Distribution: Mint 14 64bit
Posts: 71

Rep: Reputation: 16
Re: Can't change root ownership of NTFS USB hard drive

Quote:
Originally posted by rrrssssss
===================================================================

My fstab file looks like this:

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/hda1 / ext2 defaults 1 1
/dev/hdb5 /home/roy/secondHD ntfs umask=0,nls=iso8859-1,ro 0 0
/dev/hdc /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
/dev/hdd /mnt/cdrom2 auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=iso8859-1,sync,codepage=850 0 0
/dev/hda2 /mnt/win_c ntfs umask=0,nls=iso8859-1,ro 0 0
none /proc proc defaults 0 0
/dev/sdd5 /mnt/USB_HD_80 vfat pamconsole,exec,noauto,codepage=850,iocharset=iso8859-1,managed 0 0
/dev/sdc5 /mnt/USB_HD_250 ntfs pamconsole,exec,noauto,utf8,iocharset=iso8859-1,managed 0 0
/dev/sda1 /mnt/LEXAR_MEDIA vfat pamconsole,exec,noauto,noatime,codepage=850,iocharset=iso8859-1,managed 0 0

=====================================================================
I'd a problem with a sort of auto-managing of my partitions by the system and I solved it removing the option

managed

in the fstab; with this option the system will overwrite all your decision every boot.
 
Old 11-22-2005, 06:14 PM   #3
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Remove managed as sam said and add in the option
Code:
umask=0
 
Old 11-23-2005, 05:41 AM   #4
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Original Poster
Rep: Reputation: 34
Re: Re: Can't change root ownership of NTFS USB hard drive

Quote:
Originally posted by sam.pedraglio
I'd a problem with a sort of auto-managing of my partitions by the system and I solved it removing the option

managed

in the fstab; with this option the system will overwrite all your decision every boot.
==================================================================================================== ==============================================

Thank you much. I tried what you suggested and sure enough, I was able to view the contents of the NTFS USB hard drive, but upon rebooting, fstab-sync changed the name of the NTFS USB hard drive and put the original line back in fstab. So, now I am back where I started from.

I have already unstalled all of the updates for Mandriva 2006 also.

I need to disable this automated feature altogether (fstab-sync).

If you type "man fstab-sync" in a su terminal window, it offers instructions to disable it. It reads like this:


DISABLING FSTAB-SYNC
Automatic updates of the /etc/fstab file by the fstab-sync program from
the HAL daemon can be disabled by changing the 50-fstab-sync.hal sym-
link in /etc/hal/device.d directory to point to /bin/false

Do you know how to disable it? I can't seem to find the line they are refering to.

Thanks much in advance,
Roy S. Smith
 
Old 11-23-2005, 05:26 PM   #5
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Try this thread: http://www.linuxquestions.org/questions/history/371726 to disable a particular device from fstab-sync
 
Old 11-24-2005, 05:52 AM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
And please, in the future, simply report your thread and a moderator will move it accordingly

Thank you!

I'll close your other thread, and reference this one.

Cool
 
Old 11-27-2005, 04:17 PM   #7
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Original Poster
Rep: Reputation: 34
Hello forum,

I followed the advice given by removing "managed 0 0" from both USB hard drives and added unmask=0022 to the NTFS USB hard drive and disconnected the USB cable from both USB hard drives and rebooted, then connected the USB cables back, and the NTFS USB hard drive were indeed accessable at last. The padlock was gone from its folder in the mnt directory and it mounted correctly automatically.

But when I rebooted with the USB cables still attached, the padlock was back, and the NTFS hard drive was owned by root again. HAL renamed the drives and put the original lines back the way they were. My fstab now looks like this:

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/hda1 / ext2 defaults 1 1
/dev/hdb5 /home/roy/secondHD ntfs umask=0,nls=iso8859-1,ro 0 0
/dev/sdf5 /mnt/USB_HD_250 ntfs umask=0022,iocharset=iso8859-1,noauto,pamconsole,utf8 0 0
/dev/sde5 /mnt/USB_HD_801 vfat pamconsole,exec,noauto,codepage=850,iocharset=iso8859-1 0 0
/dev/hdc /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
/dev/hdd /mnt/cdrom2 auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=iso8859-1,sync,codepage=850 0 0
/dev/hda2 /mnt/win_c ntfs umask=0,nls=iso8859-1,ro 0 0
none /proc proc defaults 0 0
/dev/sdc5 /mnt/USB_HD_2501 ntfs pamconsole,exec,noauto,utf8,iocharset=iso8859-1,managed 0 0
/dev/sda1 /mnt/LEXAR_MEDIA vfat pamconsole,exec,noauto,noatime,codepage=850,iocharset=iso8859-1,managed 0 0

I'm about ready to quit and give up. I don't want to disable HAL.

Discouraged,
Roy S. Smith

Last edited by rrrssssss; 11-27-2005 at 04:47 PM.
 
Old 12-01-2005, 04:28 AM   #8
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Original Poster
Rep: Reputation: 34
Finally

Hello forum,

I am resurecting this thread just to say that I fixed my problem by disabing fstab-sync by simply renaming it in /usr/bin/sbin.

I hated to disable this auto detection feature for plug and play devices but it didn't give me a choice. Fstab-sync would always erase any changes I would make in fstab and put the original line back into place. Case in point, I couldn't add the entry unmask=0022 for my NTFS USB hard drive without fstab-sync taking it back out after a reboot. Now I finally can read the contents of my NTFS USB hard drive and it boots up mounted everytime without a hitch.

Please, if anybody knows how to make changes in the fstab file WITH fstab-sync enabled, please let me know because I really would like to run Linux with fstab-sync activated if possible.

Thanks much,
Roy S. Smith
 
Old 12-07-2005, 03:54 AM   #9
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Original Poster
Rep: Reputation: 34
Problem Solved at Last

UPDATE UPDATE UPDATE UPDATE 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.

Roy S. Smith

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

Last edited by rrrssssss; 12-07-2005 at 04:31 AM.
 
Old 12-07-2005, 04:53 AM   #10
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Good work
 
Old 12-21-2005, 06:44 PM   #11
verzalj
LQ Newbie
 
Registered: Dec 2005
Location: columbus ms
Distribution: mandriva 11
Posts: 1

Rep: Reputation: 0
Great job rrrSSSSSSS!

You really stuck with it to find a solution and help your neighbor. I'm a Linux newbie and have the same problem. I am interested in modifying my storage-policy.fdi file by adding the appropriate lines but I've looked at it and am not sure where/how to put your suggested lines at and in what exact format... I guess I'm scared of really screwing things up. BTW, In my fstab file, it shows "managed 0 0 0". Where did you get the 0022 from for the umask change? The answer to that might be too much info. Should I use umask=0022 like you said, or umask=0 like tkedwards said? If you could post a snapshot of your .fdi file, I might be able to firgure it out. Thanks in advance for your patience.
 
Old 12-21-2005, 08:03 PM   #12
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
umask=0022 would mean that everyone but the owner of the files has read only access, the owner has full access. The owner of the files/folders is specified with the gid and uid options (IIRC). The umask=0 (ie. umask=0000) will give anyone full read/write access. If you wanted to restrict write access to root or a specific user specified with uid and gid then use umask=0022, otherwise umask=0.
 
Old 12-22-2005, 02:50 AM   #13
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Original Poster
Rep: Reputation: 34
Hello verzalj,

I don't blame you for being afraid of messing things up by editing something that you are unsure of. I've messed up Linux many a times doing that and had to reinstall the entire OS since it would fail to boot up. If I had been savvy enough I could have used an editor from the console (installation CD) and fixed it instead of reinstalling the OS again. But if you mess up this file below, the worse that can happen is HAL will not work, in effect, being disabled. Nothing fatal to your computer.

But anyway, below is a copy and paste of the very first portion of my 90 default policy fdi file that I edited. I really don't think I needed to add every line shown below. I think the only line I needed to add was the "umask=0022. (I probably didn't need the "user" and "owner" line). And "umask=0" would probably work too like tkedwards said. Keep in mind that if you ever apply automatic updates to Linux, this file might get updated and you will have to add the lines all over again. That is why it is best to write your own custom fdi rule and put it in the 95 user policy directory if you can. Typing "man fstab-sync" in a terminal window will explain it better.

Another interesting note is that this "fix" does not change the ownership of the USB ntfs hard drive. Root still owns the files on it (by default) since it has a ntfs file system. But at least now it can be accessed and it will still auto mount upon reboot.








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

<deviceinfo version="0.2">

<!-- Default policies merged onto computer root object -->
<device>
<match key="info.udi" string="/org/freedesktop/Hal/devices/computer">
<merge key="storage.policy.default.mount_root" type="string">/mnt</merge>
<merge key="storage.policy.default.use_managed_keyword" type="bool">true</merge>
<merge key="storage.policy.default.managed_keyword.primary" type="string">managed</merge>
<merge key="storage.policy.default.managed_keyword.secondary"
type="string">kudzu</merge>
<merge key="storage.policy.default.mount_option.user"
type="bool">true</merge>
<merge key="storage.policy.default.mount_option.owner" type="bool">true</merge>
<merge key="storage.policy.default.mount_option.umask=0022" type="bool">true</merge>
<merge key="storage.policy.default.mount_option.noauto" type="bool">true</merge>
<merge key="storage.policy.default.mount_option.pamconsole" type="bool">true</merge>
<merge key="storage.policy.default.mount_option.exec" type="bool">true</merge>
</match>
</device>

Last edited by rrrssssss; 12-22-2005 at 04:34 AM.
 
Old 12-22-2005, 12:56 PM   #14
rrrssssss
Member
 
Registered: Mar 2005
Posts: 288

Original Poster
Rep: Reputation: 34
Custom fdi file

Guess what?

A guy from Mandriva Expert, sauza-sauzasauza-685, created a custom fdi file to put in the /usr/share/hal/fdi/95userpolicy directory and it works!

This is the best way to access the USB NTFS external hard drive as non root.

I have since put my original /usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi file back in place and thanks to the custom fdi file, I can access my external ntfs USB hard drive as non-root with the padlock off of the folder. Now I will not have to worry about software upgrades overwritting the entries that I had in the /usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi file since the custom fdi file now does the job.

Below is a copy of the custom fdi file that works:



<?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.umask=0022"
type="bool">true</merge>
</match>
</match>
</match>
</match>
</match>
</device>
</deviceinfo>

Simply save this file as a .txt file and name it "storage-policy-pers.fdi" and put it in the /usr/share/hal/fdi/95userpolicy directory. Make sure the very first character starts in the uppermost left hand corner (no space) or it will not work.

Roy

Last edited by rrrssssss; 01-31-2006 at 12:28 PM.
 
Old 07-10-2006, 05:42 PM   #15
linxthumb
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Rep: Reputation: 0
Does anyone know how to do this in FC4? Im having the same problem.
Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I've tried everything - Can't Change Root Ownership of USB HD rrrssssss Linux - Newbie 5 11-24-2005 05:52 AM
Debian usb ntfs hard drive problem hutch Debian 4 09-28-2005 10:33 PM
How to change ownership of a drive? raid517 Linux - Software 1 09-15-2005 09:15 AM
when I mount my usb hard drive, I have to be root to access it? nakedpretzel Linux - Hardware 2 02-27-2004 10:47 PM
USB hard disk drive, using NTFS Barney_cc Linux - Hardware 1 09-02-2003 03:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 05:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration