LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Gnome: Auto mounting external devices as first user logged in, not current user (https://www.linuxquestions.org/questions/linux-software-2/gnome-auto-mounting-external-devices-as-first-user-logged-in-not-current-user-628832/)

yitzle 03-17-2008 11:12 PM

Gnome: Auto mounting external devices as first user logged in, not current user
 
Debian, Gnome.
When I insert a memory card into the flash reader, Gnome/Debian automoaunts it (pmount?).
However, if there are two users logged it, it sets the mount folder's owner to whomever the first user is and the second user can not access the device.
How do I solve this?

TITiAN 03-18-2008 10:32 AM

I'm thinking of two possibilities:

(1)
The first user can umount it by opening the context menu on the device (probably right mouse button) and choosing "umount device" (could be "remove" or "aushängen" [in german], I don't know exactly). After that, the current user can use it (GNOME will automatically re-mount it when programs demand it).

(2)
If that doesn't help, you will probably have to edit the file /etc/fstab and find out what the block device file for your card reader is (probably /dev/sda or /dev/sda1); unfortunately, GNOME doesn't tell us that (I really think it should!).
Do that like this: change into a tty console (e.g. press ctrl+alt+F2; don't open a terminal/console window). Then insert a flash card; the terminal should show a bunch of messages. When I do that with USB storage, my device name (without "/dev/") appears in squared brackets, [sda], several times. To go back to GNOME, press ctrl+alt+F7 (can be ctrl+alt+F6 or ctrl+alt+any other F-key if you modified Debian so).
How to edit the file: Press alt+F2 and enter gksu gedit /etc/fstab and press Enter or click on "execute". The system will ask for the root password. If you misspell it, nothing happens (you are not even told).
Without having changed it since installation (I use GNOME's automation), my /etc/fstab looks like this:
Code:

# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    defaults        0      0
/dev/hda1      /              ext3    defaults,errors=remount-ro 0      1
/dev/hda5      /home          ext3    defaults        0      2
/dev/hda6      none            swap    sw              0      0
/dev/hdc        /media/cdrom0  auto        user,noauto    0      0

If the contents in the device /dev/sda are to be accesible by anyone, I add one line in /etc/fstab like this:
Code:

# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    defaults        0      0
/dev/hda1      /              ext3    defaults,errors=remount-ro 0      1
/dev/hda5      /home          ext3    defaults        0      2
/dev/hda6      none            swap    sw              0      0
/dev/hdc        /media/cdrom0  auto        user,noauto    0      0
/dev/sda        /mnt/sda        auto    defaults,user,umask=000  0      0

The options user,umask=000 make the device mountable and accesible by any user.

I hope this helps, good luck ;)

yitzle 03-30-2008 11:34 PM

Sorry for the late response.
The first solution doesn't work for me because the first user may not be around.
The second solution doesn't seem to work, either. When I modified my fstab, it tried mounting it on boot and failed (device wasn't present).
The same issue applies to when a USB key is inserted.
Is there a way to change the default permissions used by pmount?

EDIT: This might do it -> http://ubuntuforums.org/showthread.php?t=386400
EDIT: Or this -> http://www.togaware.com/linux/surviv...e_Manager.html

yitzle 03-31-2008 12:18 AM

It seems gnome-volume-manager doesn't play nice with multiple X11 sessions/servers running at once.
So I turn it off and use the Disk Mounter applet instead.
However, I'm having trouble keeping stuff from starting up with the new session. The session manager doesn't seem to be able to edit the startup programs that were put there when the account was set up.
For now I just ran chmod 644 /usr/bin/gnome-volume-manager

TITiAN 04-01-2008 09:43 AM

Quote:

Originally Posted by yitzle (Post 3105514)
[...]it tried mounting it on boot and failed (device wasn't present).[...]

Yes, sorry; I forgot the "noauto" option in /etc/fstab. If you add it, the system won't try to mount /dev/sda on startup, but only when a user (here: gnome) demands it.
Any questions?


All times are GMT -5. The time now is 03:06 AM.