LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 06-05-2014, 08:02 PM   #1
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slack(64|32)_v(13.37|14.0), debian6, ubuntu
Posts: 632

Rep: Reputation: 36
mounting usb as user


Hi all,
I am trying to mount a usb as a simple user (who is a member of plugdev group and has inserted the mount command in the sudoers file).

The aim is to mount and umount a usb stick from the command line as a normal user and use it normally (read , modify , create new files etc).

If i type

sudo mount /dev/sdX1 /mnt/usbstick

I will get the device mounted without a problem but it is mounted as root:root and the permissions are 755, so I can not use the stick as expected ( I can not write to it ).

I need to either add the option umask=000 , or set a uid or set gid or a mixture of the above.
These all look somewhat ugly. Is there another way that I may be missing?

thank you for your help.
 
Old 06-05-2014, 08:21 PM   #2
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 304

Rep: Reputation: 77
fstab

Quote:
Originally Posted by nass View Post
The aim is to mount and umount a usb stick from the command line as a normal user and use it normally (read , modify , create new files etc).
I have simple operations for USB storage devices. As a user I just plug in one flash drive at a time so I have the following in fstab. I created a directory /mnt/flash.

Code:
/dev/sdc1   /mnt/flash   auto   noauto,users   0 0
As a normal user I plug in the flash drive and type "mount /mnt/flash".

The option "users" allows a normal user to mount and any user to umount. You could also use "user" without the trailing 's' to restrict umount to only the user that mounted the device.

Occasionally I have to run as root to umount something when I unplug the flash drive without unmounting it first.

Most users want all of this to happen automatically no matter which device (/dev/sdxx) is used. Others on this forum would have to help with the automatic stuff (Which I turn off in Xfce).

EDIT: I ran "fdisk -l" (L) as root after plugging in the flash drive to find out the device (/dev/sdc1) that the flash drive would occupy.

Last edited by TracyTiger; 06-05-2014 at 08:25 PM.
 
Old 06-05-2014, 09:58 PM   #3
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Wheezy
Posts: 431

Rep: Reputation: 110Reputation: 110
Try looking at pmount. It lets any user mount any removeable device in the /media directory. Example:
Code:
pmount sdb1
would mount /dev/sdb1 to /media/sdb1. It gives ownership to the user who ran the command. To unmount:
Code:
pumount sdb1
NOTE: If you are in the /media directory, and run the umount command above, it will attempt to run it on /media/sdb1, not /dev/sdb1. In that case, either cd out of /media or give the full path to /dev/sdb1.

Hope this helps!
 
Old 06-05-2014, 10:05 PM   #4
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 168

Rep: Reputation: 23
This should do what you want: http://slackbuilds.org/repository/14.1/system/pmount/

`pmount /dev/sdX1` should mount it under /media/sdX1. Then use pumount as you would use umount.

The source download appears to be behind a login page, here's a mirror: http://ponce.cc/slackware/sources/re...0.9.23.tar.bz2
 
  


Reply

Tags
cli, mount, usb drive


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mounting USB Drive to a user defined point hcgrant Linux - Software 3 05-30-2013 07:05 PM
[SOLVED] user mounting of USB drive... Habitual Slackware 6 07-30-2012 09:42 PM
USB Issues: Exit code 21 kills mounting HD. How to USB diskcheck? jimwg Linux Mint 2 05-05-2012 07:41 PM
Gnome: Auto mounting external devices as first user logged in, not current user yitzle Linux - Software 4 04-01-2008 10:43 AM
Mounting USB external drive with multiple partitions, USB bluetooth mouse xmeson Slackware 7 12-17-2006 10:00 AM


All times are GMT -5. The time now is 01:17 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration