Register
It is currently Wed Sep 17, 2014 3:32 pm

Removeable devices owned by root?? Why? [solved]


All times are UTC


Post new topic Reply to topic  [ 80 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 PostPosted: Tue Feb 26, 2008 8:43 am   
Linux Guru
User avatar

Joined: Sat May 13, 2006 4:57 am
Posts: 3079
Location: Bremen, Germany
USB sticks and drives do not automount correctly

If you are experiencing problems with automounting usb sticks and/or drives, but do not have problems with automounting CDs or DVDs, and if you are able to manually mount the USB device in question, then you should create the file "preferences.fdi" in the folder /etc/hal/fdi/policy and paste the following line into the file

Code:
<merge key="volume.ignore" type="bool">false</merge>


Also, if you have gparted installed, you might need to delete this file:

Code:
/usr/share/hal/fdi/policy/gparted-disable-automount.fdi


as being mentionned at the end of this thread

Another USB automounting fix

From Antix:

None of these solutions worked for automounting usb sticks on my SONY VGN-N365E notebook running XFCE.

I edited /etc/dbus-1/system.d/hal.conf and changed the "0" below to my username:

Code:
<policy user="0">
   <allow send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/>
   <allow send_interface="org.freedesktop.Hal.Device.VideoAdapterPM"/>
   <allow send_interface="org.freedesktop.Hal.Device.LaptopPanel"/>
   <allow send_interface="org.freedesktop.Hal.Device.Volume"/>
   <allow send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/>
</policy>


Now everything automounts fine.

Using PMount

If like me you couldn't get any of the above to work you may try to install pmount. PMount is a wrapper around the standard mount program which permits normal users to mount removable devices without a matching /etc/fstab entry.

Auto-mount only removable media

By default hal automounts all available partitions not mounted in /etc/fstab and create desktop icons for them. To override this behavior and automount only removable drives, just add this rule:

Code:
<device>
   <match key="storage.hotpluggable" bool="false">
     <match key="storage.removable" bool="false">
       <merge key="storage.automount_enabled_hint" type="bool">false</merge>
     </match>
   </match>
</device>


If you are running KDE, and the device is being automounted (i.e. it comes up in Konquerer), but it is not on the desktop go to control center -> Desktop -> Behavior -> Device Symbols (3rd Tab) and make sure the box is checked.

Automount NTFS filesystems with write support (ntfs-3g)

If you want write support for automounted NTFS filesystems, you must install ntfs-3g, then add this rule:

Code:
<device>
     <match key="volume.fstype" string="ntfs">
       <match key="@block.storage_device:storage.hotpluggable" bool="true">
         <merge key="volume.fstype" type="string">ntfs-3g</merge>
         <merge key="volume.policy.mount_filesystem" type="string">ntfs-3g</merge>
         <append key="volume.mount.valid_options" type="strlist">locale=</append>
       </match>
     </match>
   </device>


Note: starting from version 2.20 Gnome uses ntfs-3g for mounting ntfs partitions, so you don't need this anymore.
[edit]
mount.ntfs linking

As of hal => 0.5.10 the above policy may not work. This is a workaround forcing hal to use the ntfs-3g driver instead of the standard ntfs driver. Please note that this method will use the ntfs-3g driver for all NTFS drives on your system! As root create a symbolic link from mount.ntfs to mount.ntfs-3g

Code:
# ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs


Possible issues using this method:
if mount is called with "-i" option it doesn't work
possible issues with the kernels ntfs module
[edit]
Locale issues

If you use KDE, you may have problem with filenames containing non-latin characters. This happens because kde's mounthelper is not parsing correctly the policies and locale option. There is a workaround for this:

1) Remove the "/sbin/mount.ntfs-3g" which is a symlink. code: rm /sbin/mount.ntfs-3g

2) Replace it with a new bash script containing:
Code:
#!/bin/bash
/bin/ntfs-3g $1 $2 -o locale=en_US.UTF-8 #put your own locale here


3) Make it executable: chmod +x /sbin/mount.ntfs-3g

There is only a problem with partition labels containing spaces, so if you have such a label, replace the space with an underscore, otherwise when you try to mount it you will get an error.

Note: If ntfs-3g package gets updated the above script will be replaced so repeat the process.

Allow dmask and fmask for ntfs-3g

dmask and fmask are very useful for setting different access rights for directories and files, e.g. dmask=000,fmask=111 will make directories accessible to all, while files will stay non-executable.

Code:
<device>
        <match key="volume.fstype" string="ntfs">
            <append key="volume.mount.valid_options" type="strlist">dmask=</append>
            <append key="volume.mount.valid_options" type="strlist">fmask=</append>
        </match>
    </device>


For dbus and hal to function properly, local user accounts must be members of the following groups: optical, storage. To achieve this, open a terminal and type the following commands as root:

_________________
openSUSE - Desktop, Symbian3 - NOKIA N8-00


Top
 Profile WWW  
 PostPosted: Tue Feb 26, 2008 11:22 am   
Sr. Member
User avatar

Joined: Tue Jul 04, 2006 3:01 am
Posts: 1074
Location: Rochester, NY
DedannaRocks! wrote:
Another reason being, that NTSF-3G, regardless of how it's put out, regardless of how they spin it, it doesn't work.


You mean in Mandriva. I have ntfs-3g working just fine on my machine.

Very informative post jada!

_________________
Ubuntu 8.10 (64-bit), Ubuntu 7.10 (64-bit)
OpenFiler 2.2 (rPath Linux base), Mythbuntu 8.10


Top
 Profile  
 PostPosted: Tue Feb 26, 2008 12:02 pm   
Keeper of the BIG STICK
User avatar

Joined: Wed Apr 30, 2003 7:16 pm
Posts: 12677
Location: Planet Earth
ntfs-3g works just fine in Mandriva.

_________________
Laptop: Kubuntu 14.04
Desktop: Mageia 1 - kernel 2.6.38.7-desktop-mga


Top
 Profile YIM  
 PostPosted: Tue Feb 26, 2008 12:06 pm   
Sr. Member
User avatar

Joined: Tue Jul 04, 2006 3:01 am
Posts: 1074
Location: Rochester, NY
Ok, then just on DedannaRocks!' computer. :) Point is the statement that it doesn't work is a blanket statement and is not true (of course, mine was also blanket and false so that puts me in my place) ;)

_________________
Ubuntu 8.10 (64-bit), Ubuntu 7.10 (64-bit)
OpenFiler 2.2 (rPath Linux base), Mythbuntu 8.10


Top
 Profile  
 PostPosted: Tue Feb 26, 2008 2:49 pm   
Linux Guru
User avatar

Joined: Sat Apr 03, 2004 12:39 am
Posts: 11505
Location: Clinton Township, Michigan
Jada, outstanding post and great information! Thanks a bunch!

_________________
Brian Masinick
Distros: SimplyMEPIS, antiX, Debian


Top
 Profile WWW YIM  
 PostPosted: Tue Feb 26, 2008 7:13 pm   
User avatar
Germ wrote:
ntfs-3g works just fine in Mandriva.

Not here, and I have everything ntfs, ntfs-3g, usb, etc. installed.

Think I'll use jada's fix(es) there -- will copy & paste them into a doc later.


Top
  
 PostPosted: Wed Feb 27, 2008 12:59 am   
. . . .
User avatar

Joined: Mon Apr 21, 2003 3:56 pm
Posts: 8044
DedannaRocks! wrote:
usb devices owned by root is only one of the many reasons I formatted my usb external hdd to jfs, what is now yesterday.

Another reason being, that NTSF-3G, regardless of how it's put out, regardless of how they spin it, it doesn't work.

I was able to change ownership of the whole drive, the works after reformatting it.

DedannaRocks!, somewhere back in time, I think it is in this thread, I posted that my USB drive is a hard disk, that it is formatted EXT3, and for a brief moment, I believe I mentioned that it worked as I expected it to work, in PCLOS.
Not so, today.

2 problems arise.
1] One distro assigns root.root when it formats the external disk drive, another distro expects removables to be 500.root, or anything inconsistent with the initial distro settings.
2] Most distros I've used lately seem to forget the permissions that the sysadmin manually set, because what I see today in PCLOS is not working, but worked just a week ago.

To resolve #1], we need some cross distro policy that gets agreed to by multiple distros. I, for one, declare that any storage device that connects via external USB (or firewire, or external SATA, ETCETERA) should be considered as USER owned. In other words, if I can access the PHYSICAL port, I expect it to be user privileged (JUST LIKE FLOPPIES AND CDS AND DVDS). As for item #2], distro installation and setup routines need to ask the administrator that is setting up the system to define a removables permissions policy.


Top
 Profile  
 PostPosted: Wed Feb 27, 2008 1:29 am   
Linux Guru
User avatar

Joined: Sat Apr 03, 2004 12:39 am
Posts: 11505
Location: Clinton Township, Michigan
I dp not know if these specs are is the LSB = Linux Standard Base or not but they should be, which describes directory layout, standard startup (init) conventions, library interfaces and many other things. Should include device conventions as well.

_________________
Brian Masinick
Distros: SimplyMEPIS, antiX, Debian


Top
 Profile WWW YIM  
 PostPosted: Wed Feb 27, 2008 3:46 am   
. . . .
User avatar

Joined: Mon Apr 21, 2003 3:56 pm
Posts: 8044
Incorporation into the LSB makes some sense; I'd rather it was part of FHS. Whichever is elected, lets get consensus by including input from the userbase, not just asking sysadmins what sysadmins want. After all, there is little user benefit to creating a multi-user system if users cannot transfer data in any way other than network access. These (user connectable external storage) devices were created by the demand of users, lets not ignore their purposes. It's a fundamental issue.

EDIT: I initially posted the next to last sentence as "These (user connectable USB storage) devices..." but because the post sums up a Linux failure that occurs with many other system interfaces, I've decided that I had worded it poorly, restricting my comment to only USB interfaces was simply an editing oversight on my part. For example, I have PCMCIA/cardbus based Compact Flash in this laptop; in my desktop system, I have a 12 in 1 media reader, a Firewire card that provides internal and external ports and a TV card that offers an S-Video interface... as well as USB on both systems. As a user, I can connect to each of these I/O ports and as a multimedia orented Linux user, I expect to use files transported via those ports, without needing to make a hundred system level permissions edits, after asking questions in a dozen forums. And for crying out loud, I definitely do not want to reformat a Sony Memory stick in order to get Linux permissions to read/write the device - the Sony camera does NOT support ext3/Reiser/.... and so forth.
Do Mac users suffer this? Windows?


Last edited by mmmna on Wed Feb 27, 2008 7:18 pm, edited 1 time in total.

Top
 Profile  
 PostPosted: Wed Feb 27, 2008 2:20 pm   
User avatar
mmmna wrote:
DedannaRocks! wrote:
usb devices owned by root is only one of the many reasons I formatted my usb external hdd to jfs, what is now yesterday.

Another reason being, that NTSF-3G, regardless of how it's put out, regardless of how they spin it, it doesn't work.

I was able to change ownership of the whole drive, the works after reformatting it.

DedannaRocks!, somewhere back in time, I think it is in this thread, I posted that my USB drive is a hard disk, that it is formatted EXT3, and for a brief moment, I believe I mentioned that it worked as I expected it to work, in PCLOS.
Not so, today.

2 problems arise.
1] One distro assigns root.root when it formats the external disk drive, another distro expects removables to be 500.root, or anything inconsistent with the initial distro settings.
2] Most distros I've used lately seem to forget the permissions that the sysadmin manually set, because what I see today in PCLOS is not working, but worked just a week ago.

To resolve #1], we need some cross distro policy that gets agreed to by multiple distros. I, for one, declare that any storage device that connects via external USB (or firewire, or external SATA, ETCETERA) should be considered as USER owned. In other words, if I can access the PHYSICAL port, I expect it to be user privileged (JUST LIKE FLOPPIES AND CDS AND DVDS). As for item #2], distro installation and setup routines need to ask the administrator that is setting up the system to define a removables permissions policy.

I couldn't agree with you more.

I also agree with your next post 100%.

Something seriously needs to be done. I'm like, super-duper tired of this with USB+Linux. Needs to be addressed badly.

I don't care that I've reformatted just so I can access my external usb drive; I don't care to have Windows anything on my machine.

However, there are those who do, and for newbies, this is going to be a rather serious issue if it keeps up like it is.


Top
  
 PostPosted: Mon Feb 16, 2009 4:16 am   
. . . .
User avatar

Joined: Mon Apr 21, 2003 3:56 pm
Posts: 8044
PCLOS has just converted to using HAL, and they are very close to getting this resolved. They just did a big update to their repos. My former setup was finally as workable as I could get it: pop in a USB device, wait a second, it shows up. As of the last time I posted here, in this thread, I believe I hadn't been fully resolved, but in any event, I was ok until the big repo update last week.

After the update, I was getting Deja-Vu: I couldn't mount a CD or DVD or any USB storage. Now, after the update, you edit your fstab, comment out the entry for each cd or dvd drive (thus, HAL gets to control it), and now CD/DVD works as expected, even though fstab has essentially no information after commenting (so the cd and dvd are only mounted by HAL).

As for restoring USB capability, it seems PCLOS needs to set up some kind of HAL refresh. After cold bootup, I can't mount USB storage until I stop then restart haldaemon, then they all work. Weird.


Top
 Profile  
 PostPosted: Mon Feb 16, 2009 11:28 am   
Linux Guru

Joined: Thu Mar 20, 2008 6:59 am
Posts: 5856
Location: Southern Illinois
We have lost in the dust many who tried the wrong Linux over this stupid crap. Permissions differences between Linux are a hassle.

Without compromising security, there has to be a simple way to assign permissions for USB devices ( including flash drives, externals, and the like ), eSATA externals ( which many distros see as an internal and don't mount..and no SIMPLE way to do so ), internal storage arrangements ( RAID or what have you ), and of course Opticals during install or though a friendly GUI. I don't want windows, but I want to have the NooB to be able to use his or her devices in a safe way.

Of course most newer externals are NTFS and the ability to mount those is denied for the NooB by many distros until he or she complies with the old boys club rules. Those who allow the mounting of non-windows NTFS partitions to avoid some idiot wiping out his or her windows OS are a step ahead. ( but would that be such a bad thing. <G>< sorry it was a funny. ). Reformating to a Linux compatible file system for those who use both Linux and windows is one option if the appropriate program is added to all windows boxes who have to address it, but not a very good one .IMO.

Seriously the fact all internal partitions FAT and NTFS are seen as windows partitions by many distros and deny mounting them make the use of internal RAID storage or eSATA \externals short of CLI work beyond most NooB. FAT32 is no longer the answer for a common partition as all too many files and ISO's are now to big to be stored on FAT32 partitions.

If Linux users have these concerns, what is the NooB to do.

And to me, the answer it is the Linux way for security reasons is not an answer.

To be sure it frustrates me also I cannot mount my eSTA external because it is seen as an internal device in any easy way, but I assume Linux will catch up om this in time...or not. <G><

_________________
Sol: 1. Kubuntu, XP, Sabayon 2. Mandriva,Mint, Mephis
Thor: 1. VISTA, Fedora 2. Chakra, Debian
Sam:XP, SuSE Zues: win7, SuSE testing


Top
 Profile  
 PostPosted: Wed Feb 18, 2009 1:49 am   
. . . .
User avatar

Joined: Mon Apr 21, 2003 3:56 pm
Posts: 8044
Well, the fix is, IMO, completed.

PCLOS + Big Update +specific edits of /etc/fstab + a newer kernel = haldaemon works the show perfectly. Well, by perfectly I mean as far as I've played with the results.

Right now, ALL user insertable/removable devices are mounted as rw USER. My ext3fs external hard disk mounts as rw for USER. I can insert EVERY possible device and haldaemon gets them all sorted out and mounted. I have a media reader, it can mount 4 Flash cards at once, the new setup sees them all, after those are mounted, I can add 2 USB Flashdrives and my external hard disk, nothing unusual, good-old automounting takes place.

I don't know if this next part is a haldaemon issue or not (could be umask, could be another problem): I touched an empty file, it was created as owner mmmmna and group mmmmna, just as my system is set for. I then dropped to a bash prompt (as user) and I tried this: "chown root:root file" and bash refused to do it. I tried "sudo chown root:root file", still no changes. I then switched to root user (e.g., su enter and I then logged in). As ROOT, I could THEN change owner and group. This violates the premise that the owner of a file (or folder, or folder and recursive through all folder contents) can chown it to ANYONE. At the moment, I'm not seeing this as a problem for my day to day Linux use, but I suspect something rootish or haldish will eventually get things wrong. More on this another day.

PCLOS: this is good stuff.


Top
 Profile  
 PostPosted: Wed Feb 18, 2009 2:16 am   
Linux Guru
User avatar

Joined: Sat Apr 03, 2004 12:39 am
Posts: 11505
Location: Clinton Township, Michigan
mmmna wrote:
Well, the fix is, IMO, completed.
PCLOS: this is good stuff.


Is this PCLinuxOS' test version for PCLinuxOS upcoming 2009 release, MiniME 2008, PCLinuxOS 2007, or something else altogether?

The PCLinuxOS testing seems to be progressing along, but I have noticed that they explicitly say not to expect to upgrade any of the test releases to the final release, which is why I am asking and wondering which spin you are using.

PCLinuxOS releases tend to be among the best in quality, right up there with SimplyMEPIS and Debian, for my purposes anyway. I have not found the test releases in the current cycle to be up to that standard, but then again, that is why they are tests and not releases.

_________________
Brian Masinick
Distros: SimplyMEPIS, antiX, Debian


Top
 Profile WWW YIM  
 PostPosted: Wed Feb 18, 2009 3:15 am   
. . . .
User avatar

Joined: Mon Apr 21, 2003 3:56 pm
Posts: 8044
I started with MiniMe 2008 that had been installed to my systems hard disk (it worked so VERY well!). I had been updating it every few weeks or so.

I visited their forums last week and saw they were about to drop a big repository update. I read up on the update, and waited until the word went out to start.

I then performed the "Big Update". The update was rather major. I saw something like 140 NEW packages in ONE update (I was up to date just a few days before this big update), and from their forum advice, I was to immediately reboot and immediately update once again. After the second update I immediately rebooted, and the removable stuff all but stopped working. Interestingly, my fingernails aren't bitten down.

A few PCLOS forum posts later, here I am.

I am at "MM2008 + BU + kernel update (2.6.26.8.tex3) + /etc/fstab edits".

I am not interested in installing the 2009 release candidate (and 2009 testing is over for now in any event).


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 80 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Jump to:  
cron


Powered by phpBB © 2012 phpBB Group
© 2003 - 2012 USA LINUX USERS GROUP