You are not logged in.

#1 2011-09-07 06:10:59

gregorias
Member
Registered: 2011-09-07
Posts: 3

[SOLVED] How to make pendrive be available to mount by nonroot user?

Hello,

So I'm 2 days old arch linux user. I've managed to install everything I wanted so fat without much problem (basic tools, xmonad), so far I like it. It's fun.

Since arch doesn't automatically mounts pendrives like I'm used to in Ubuntu so I decided to be able to mount as normal user and added:

/dev/sdb /media/pendrive vfat defaults,user 0 1

Everything worked fine until I installed dosfstools (so as to have mkfs.vfat). After that my system wouldn't start without pendrive in USB slot. (Probably because dosfsck couldn't check it). So I tried changing that fstab line to:

/dev/sdb /media/pendrive vfat rw,suid,dev,exec,noauto,user,async 0 1

(Same as defaults but with noauto instead auto).
It didn't work. So I have commented the fail entry. Is there any solution to my problem (mounting as non-root user)?

Last edited by gregorias (2011-09-09 17:56:58)

Offline

#2 2011-09-07 06:37:22

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

What desktop environment are you using? In xfce, for example, you need to have dbus running for automount to work.

https://wiki.archlinux.org/index.php/Xf … ithin_Xfce

You should be able to search the forums or Google for your specific DE.

Offline

#3 2011-09-07 06:47:50

gregorias
Member
Registered: 2011-09-07
Posts: 3

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

I'm running xmonad.
I don't necessarily want automount (I'll probably give it a look after a while, thanks). I just want to be able to do:

mount /media/pendrive

or

mount -t vfat /dev/sdb /media/pendrive

as non-root user.

Last edited by gregorias (2011-09-07 06:48:23)

Offline

#4 2011-09-07 06:49:06

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

I'm not sure, but does the user need to be in the "storage" group to mount USB drives?

Offline

#5 2011-09-07 07:10:55

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

I would suggest changing your 'pass' value from 1 to 0.  Only the root filesystem should have a pass value of 1.  I use pass values of 2 for internal drive partitions, 0 for USB flash drives.

I have this in my fstab, copied from an old Opensuse installation:

UUID=B566-F106  /media/adata  vfat  rw,noatime,users,noauto,nosuid,nodev,shortname=lower,async,flush,utf8,gid=100  0 0

My desktop PC has multiple ports and I use only four devices that are seen as vfat-formatted flash drives.  Easy way out, not knowing if the USB drive would be sde...sdh, was to use the UUIDs for them.  'shortname=lower' is because of the Windows name mangling – Windows doesn't distinguish between upper and lowercase and has both short (8+3) and long names for any file.  'async' and 'flush' are to make sure data is promptly written (and see the warning about using 'sync' on flash drives in 'man mount').  'utf8' allows filenames with characters outside my normal 256 ASCII characters – umlauts, cedillas and CJVK.

Offline

#6 2011-09-08 16:30:44

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

gregorias wrote:

I'm running xmonad.
I don't necessarily want automount (I'll probably give it a look after a while, thanks). I just want to be able to do:

mount /media/pendrive

or

mount -t vfat /dev/sdb /media/pendrive

as non-root user.

I do this by installing the "pmount" package... just 'cause I'm too lazy to su to root.

It needs the device name (/dev/something) when you execute the command, but it works fine as a regular user.

You can tell it where to mount the device, or just run the "pmount" command with no arguments to see where it mounted it.

And "pumount" will unmount the device. Just cruise the man pages for more info.

NOTE: Even though the "pumount" man pages says that you need to give it the device name as a parameter (/dev/something) to unmount the device, I've found that using the mount point (/media/something) instead will also work.

Offline

#7 2011-09-08 16:49:19

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

Why not just use something that automounts like eg udiske/thunar/pcmanfm/nautilus/whatever?


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#8 2011-09-08 17:13:37

Awebb
Member
Registered: 2010-05-06
Posts: 6,275

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

If you don't mind running dbus (and either consolekit or configuring udisk), then you might want to check bashmount. It's in the AUR and developed by a fellow Archer if I'm not mistaken.

Offline

#9 2011-09-08 17:40:35

BaconPie
Member
Registered: 2010-08-11
Posts: 209

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

This is what I have in my fstab:

$ grep TOMLAD /etc/fstab
/dev/disk/by-label/TOMLAD     /media/TOMLAD    auto    rw,user,noauto,async    0   0

The mount point has the following permissions:

$ ls -l /media/ | grep TOMLAD
drwxrwx--- 2 root storage 4.0K May 25 19:56 TOMLAD/

That is, it is owned by root, but anyone in the group 'storage' has rwx access. Any user in the storage group can now just type:

$ mount /media/TOMLAD

Simple. I actually have a whole bunch of mount points so I can mount any external disks whenever.

Auto means that it will auto mount the device during boot. If the OS doesn't find it then it won't boot because there must be a problem. Remember, this was invented for servers were the storage doesn't just disappear.

Also, it's a good idea to give your pendrive a name so that you can refer to it by name instead of /dev/sdb since this changes as you plug in more devices.

Last edited by BaconPie (2011-09-08 17:49:22)

Offline

#10 2011-09-08 18:01:17

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

Mr.Elendig wrote:

Why not just use something that automounts like eg udiske/thunar/pcmanfm/nautilus/whatever?

Not sure who that question is directed at, but one of my boxes is a very minimal headless system that doesn't even have X installed.

Last edited by pigiron (2011-09-08 18:02:46)

Offline

#11 2011-09-09 14:07:50

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

pigiron wrote:
Mr.Elendig wrote:

Why not just use something that automounts like eg udiske/thunar/pcmanfm/nautilus/whatever?

Not sure who that question is directed at, but one of my boxes is a very minimal headless system that doesn't even have X installed.

It was aimed at the OP.

As for you, udiskie etc doesn't require X.

Last edited by Mr.Elendig (2011-09-09 14:08:14)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#12 2011-09-09 17:58:30

gregorias
Member
Registered: 2011-09-07
Posts: 3

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

Thank you all for answers. pmount is exactly what I need, but I'll check every option presented here.

Adding myself to storage group doesn't work.

Offline

#13 2011-09-10 06:07:53

BaconPie
Member
Registered: 2010-08-11
Posts: 209

Re: [SOLVED] How to make pendrive be available to mount by nonroot user?

gregorias wrote:

Adding myself to storage group doesn't work.

Is the mount point in the storage group with rw access?

Offline

Board footer

Powered by FluxBB