Author Topic: [SOLVED] Mounting Devices as User  (Read 968 times)

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
[SOLVED] Mounting Devices as User
« on: July 20, 2010, 02:04:44 PM »
When I plug in a USB device I can click on it in Dolphin and it mounts and displays the contents.

All rather magical really ......  handled by some udev rule I think as opposed to the mount command which requires root privileges.

Anyway the actual method used is not a concern directly ......  but I do have a question I would like answered if someone has any ideas .......

Is there any command that can be invoked which will allow a user to mount a partition of a USB drive .......  something maybe that could be placed within a script which runs with user privileges?

Thanks for reading and any suggestions (polite ones of course   :D  ) that may be forthcoming.

regards.
« Last Edit: July 21, 2010, 02:00:27 AM by JohnBoy »

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6254
Re: Mounting Devices as User
« Reply #1 on: July 20, 2010, 02:22:15 PM »

"mount" command is the only command that can be used to mount file systems.

A normal user can use the command directly to mount/unmount a file system only if the file system has an entry in fstab and has a "user(s)" option set.

Since you are dealing with an external device, use uuid to specify the device in fstab
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Mounting Devices as User
« Reply #2 on: July 20, 2010, 04:49:13 PM »

"mount" command is the only command that can be used to mount file systems.

A normal user can use the command directly to mount/unmount a file system only if the file system has an entry in fstab and has a "user(s)" option set.

Since you are dealing with an external device, use uuid to specify the device in fstab

Thanks for the response   ;)

fstab is only suitable if the device does not change, so of no real use to me.
I was trying to find a means of mounting a filesystem as user in  /home/<user> .....  or even as user under /media ....  just as is done by something in a filemanager when opened with user privileges.

regards.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11598
  • ----IOFLU----
Re: Mounting Devices as User
« Reply #3 on: July 20, 2010, 07:10:35 PM »

"mount" command is the only command that can be used to mount file systems.

A normal user can use the command directly to mount/unmount a file system only if the file system has an entry in fstab and has a "user(s)" option set.

Since you are dealing with an external device, use uuid to specify the device in fstab

Thanks for the response   ;)

fstab is only suitable if the device does not change, so of no real use to me.
I was trying to find a means of mounting a filesystem as user in  /home/<user> .....  or even as user under /media ....  just as is done by something in a filemanager when opened with user privileges.

regards.

Define that line. In what manner is the device changing? If you are speaking of USB stick drives as opposed to real USB hard drives, and possibly numerous ones, label the partitions on each with the same labels, then use those labels in fstab. Whichever is plugged in, mounting by label will then work. Use the mount point in the command;

[prompt ~]$ mount /home/<user>/<whatever>

Works for me.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Re: Mounting Devices as User
« Reply #4 on: July 21, 2010, 01:17:25 AM »
Is there any command that can be invoked which will allow a user to mount a partition of a USB drive

pmount

pmount will only work if the device is not listed in /etc/fstab. pmount permits a normal user to mount a removable device without an fstab entry.
« Last Edit: July 21, 2010, 01:27:26 AM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Mounting Devices as User
« Reply #5 on: July 21, 2010, 02:00:04 AM »
Is there any command that can be invoked which will allow a user to mount a partition of a USB drive

pmount

pmount will only work if the device is not listed in /etc/fstab. pmount permits a normal user to mount a removable device without an fstab entry.


Thank you!

I had thought that had been deprecated so never followed up the reference to it I came across .......  that will I believe do as I wish.
Thank you for the kick ......  sometimes one gets side-tracked so much that the obvious is no longer visible.

old-polack
                 the best actual situation I could describe would be, as you said, a USB flash drive, previously unknown to you, plugging into your PC with an unknown number of other USB devices plugged into it, and wishing to access the contents of the new device as the user through some script or other.
     Yeah I know rather a weird mock up of a situation, but I had to come up with something cause you asked     ;D

I believe my problem is solved.

Thanks for the help folks.

regards.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: [SOLVED] Mounting Devices as User
« Reply #6 on: August 04, 2010, 11:55:49 AM »
I just want to add, for anyone searching for the info that there are some options I have only become aware of .... so here is my present list .....

pmount               pumount

pmount-hal         pumount

gnome-mount      gnome-umount    or     gnome-mount -u

Each does things slightly differently ....