LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-09-2008, 06:32 AM   #1
Haines Browsn
LQ Newbie
 
Registered: Dec 2004
Posts: 7

Rep: Reputation: 0
Permissions and ownership of /media and /mnt


In the past, I've been too much in a hurry and simply changed ownership of /media and /mnt to ownerwner, although I suspect that was not correct.

My inclination would be to assign these mount point directories to a group, and then put users into the group. No standard group seems appropriate. When I plug in a usb-stick, it is assigned to a device interface in floppy group (I'm running sidux on a Thinkpad X61s) and wonder if that is an obvious group name.

Is changing permission of these directories to ownerwner OK? Or should I take care of the problem in fstab? If not, should I assign a group? Would "floppy" be appropriate?

Haines Brown
 
Old 03-09-2008, 07:27 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
No. Normally the permissions of the mount point don't matter because they will be changed when something will be mounted over them. However, /media and /mnt are probably the parent directories of the mount points anyway.

Which desktop environment do you use. I'm not familiar with Sidux. Does it use hal?
Does a dialog box pop up on the screen if you insert a pen drive? If so, is there a properties button you can hit. It may have mounting options including to mount using the users uid.

You can add an entry in /etc/fstab for your pendrive. I would recommend using the label or filesystem uuid to mount it instead of the device node. If you do this, I would recommend using a mount point under /mnt/ instead of /media/.

If you insert the pendrive, determine which device node was used. Either from /var/log/messages or dmesg or ls /dev/sd* or "sudo /sbin/fdisk -l". There are numerous ways to get that info.

The use "udevinfo -q env -n /dev/sdXN" where sdXN is a device node such as sdb1. Note the line for the filesystem uuid and copy the value.

Then when you edit /etc/fstab, you can use:
Code:
UUID=<the fs_uuid number> /mnt/pendrive vfat rw,noauto,nosuid,nodev,noatime,flush,uid=<username>,utf8,shortname=lower
Now you will be able to mount the pendrive as a normal user entering "mount /mnt/pendrive". It is the "user" option that does this magic. The mount program has its suid bit set, but is careful to only allow regular users to mount if the /etc/fstab entry says so.

The "noauto" option prevents stalling during bootup because a removable drive isn't plugged in. The "uid=" and "gid=" options change the ownership and group of the mounted filesystem. The chmod and chown commands won't even work on a fat32 filesystem.

To change the permissions, you need to include other options in the fstab entry as well.
"fmask=0660,dmask=0770" will result in rw-rw---- permissions on all files and rwxrwx--- permissions for all directories.

Good Luck!
 
Old 03-09-2008, 12:46 PM   #3
Haines Browsn
LQ Newbie
 
Registered: Dec 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for all the tips. I had concluded that what really mattered in this case was putting users as option in fstab.

You suggest: "/media and /mnt are probably the parent directories of the mount points anyway". Well, I'm trying to avoid having mount points in /mnt, which I see as a temporary mount point in itself. I know I'm bucking the trend.

> Which desktop environment do you use. I'm not familiar with Sidux.
> Does it use hal? Does a dialog box pop up on the screen if you insert
> a pen drive? If so, is there a properties button you can hit. It may
> have mounting options including to mount using the users uid.

This is a new installation that by default gave me a desktop manager, but I'm about to purge it and run just on a window manager. Sidux is a modification of the debian unstable version (Sid). Debian generally is very conservative, which is a good thing in my view, but I've installed debian on new hardware (Thinkpad X61s), and so need something more cutting edge. Sidux is both cutting edge and yet fairly stable.

Sidux uses HAL. The KDE mount dialog will happily disappear when I purge KDE. I would be inclined to use LABEL in fstab for my USB-key. Although this little laptop has no optical or floppy drive and one usb-jack, the reason I'd bother with labels is that some of my usb-keys are formatted vfat and others ext3 (such as the one I used to install the system).

On my desktop system, where I've got all kinds of things to plug in and sometimes use multiple scsi disk, the jumping about of the device interface can be a nuisance, and certainly need LABELs and UUIDs.
 
Old 03-11-2008, 05:12 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If your distro uses hal, one thing to watch for is that you don't have the "noacpi" boot option. Auto-mounting won't work with it. You will need a separate /etc/fstab entry for each unique label or UUID. You could have some similar pen drives using the same label however. For example, two labeled "PODCASTS". As long as they used the same filesystem, they would then be mounted the same which would be convenient. My concern with using /media is that the hal/udev system creates and deletes directories there on the fly. You could end up having to recreate a mount point before mounting a pendrive.
 
  


Reply



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
permissions and ownership on dir gabsik Linux - Software 4 02-05-2007 06:48 AM
ln -s /mnt /media alaios Linux - Newbie 2 10-11-2004 06:21 PM
Compile Package Permissions Ownership Changes PDock Linux - General 0 08-17-2004 07:52 AM
Question about ownership/permissions infornography Linux - Newbie 7 07-28-2004 05:57 AM
write permissions / ownership bynaar Slackware 15 08-08-2002 04:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:55 AM.

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