SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I just bought a USB hard disk and when I plug it in it gets mounted as owner root and group root. I tried writing a udev rule for it based on the following guide:
HAL/The Desktop should obey any settings in /etc/fstab when mounting, so just put an entry in there specifying whatever options you want it to use.
Because it's an external usb device I'd recommend you use LABEL= or UUID= rather than the /dev/sd?? device in the /etc/fstab because the device name may vary when the drive is plugged-in in future.
Is it an NTFS-formatted drive? If so it is possible that it is trying to mount read-only using the standard kernel module instead of using ntfs-3g through FUSE. I do not know why it would mount as root:root though -- it should still be using the plugdev group. An fstab entry is a foolproof solution but it would not explain why it is getting mounted with the wrong ownership (and permissions?) by default when using HAL.
Ahh, I was working on the principle that it was a NTFS.
if it's an ext filesystem, then the permissions will be those of the top level directory of the filesystem it contains. Just mount it as root and then do a standard chown/chmod on it.
No. the permissions/ownership are stored in the filesystem itself. So next time you mount the filesystem the values will still be as you set them.
Just remember to chmod after you mount it, otherwise you'll be setting the permissions of the mountpoint directory it's mounted on and not of the top directory of the filesystem.
You might want to consider chmod 1777 which will set it up to work exactly like /tmp. i.e. everyone can use it, but you can only delete your own files/directories.
Then if you add an fstab entry with "noauto,user" any user should be able to mount it.
http://freedesktop.org/wiki/Software/hal has what little else there is (and it leads you to the above link). You'd think that someone would have documented the damned thing after a year or so.
No. the permissions/ownership are stored in the filesystem itself.
Unless he's using the links autogenerated in /media. In Gnome, Nautilus would be responsible for creating the directories; in KDE something else is doing that work.
Unless he's using the links autogenerated in /media. In Gnome, Nautilus would be responsible for creating the directories; in KDE something else is doing that work.
Once the filesystem is mounted though, those directories will have been overmounted so their permissions won't matter. That's Unless gnome/kde desktops do a chmod/chown after the filesystem is mounted to alter the permissions of the top directory (In which case; OMFG! NO!!!!! and I'm even more glad I do things the old fashioned way! ).
GazL, your solution worked. I added a line to /etc/fstab, made a directory for it: /mnt/passport, mounted as root, chown, re-booted, and the disk was mine. I too still prefer the old-fashioned way. Mike.
GazL, your solution worked. I added a line to /etc/fstab, made a directory for it: /mnt/passport, mounted as root, chown, re-booted, and the disk was mine. I too still prefer the old-fashioned way. Mike.
It's certainly simpler than all this udev/hal nonsense.
Here is how I mount usb sticks. The udev rules are not that hard for usb drives, you just create one rule then copy it for all your drives and all you have to change is the serial no. ( ATTRS{serial}== ) which is easy to find using 'lsusb -v|less'.
This is one of my rules in /etc/udev/rules.d/01-automount.rules
KERNEL=="sd?1", ATTRS{serial}=="01234567890" , ACTION=="add", RUN+="/usr/local/bin/automountit KINGDT2G01 -m -r"
KERNEL=="sd?1", ATTRS{serial}=="01234567890" , ACTION=="remove", RUN+="/usr/local/bin/automountit KINGDT2G01 -u"
The automountit script will create the directory /media/KINGDT2G01 then mount the device and set the permissions. And as an added convenience it modifies the Dolphin.desktop file so when I clik on it dolphin opens with split panels and it is already set to the device's root directory and the other panel is $HOME.
So all I do is plug in the device, wait a couple seconds and it is mounted and ready to go. Also when I remove the device the automountit script will remove the /media directory and return my Dolphin.desktop back to normal.
NOTE: KINGDT2G01 is just a name I made up to identify the device, it stands for Kingston DataTraveler 2G No. 1. I have quite a few usb sticks and this makes it alot easier to keep track of them.
Also I use /dev/disk/by-id or /dev/disk/by-label in the /etc/fstab file, as was mentioned in an earlier post /dev/sdX1 is not a reliable way to mount removable usb drives.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.