LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-12-2017, 01:23 PM   #1
lobsang
LQ Newbie
 
Registered: Mar 2017
Posts: 11

Rep: Reputation: Disabled
Red face Setting USB flash writable to particulla user in /etc/fstab


How can i set in /etc/fstab for a particular user to allow usb flash drive writable when mounted .

e.g. how to allow user fred in /etc/fstab to access usb flash drive writable when mounted

Code:
/dev/sda1  /mnt/usbflash  vfat defaults, users,_____?____=fred,umask=022,0,0
 
Old 08-12-2017, 01:48 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,555

Rep: Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862
I'd get the 'defaults' out and try 'user' instead of 'users'. I don't believe it takes individual users, but if you mount it on it's mount point and run
Code:
chown -R  <user:group> <mountpoint>/*
chmod -R 0700 <mountpoint>/*
filling in the correct options you should have it so that the chosen user can do stuff and other users can't.

Last edited by business_kid; 08-12-2017 at 01:50 PM.
 
Old 08-12-2017, 01:49 PM   #3
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 2,278
Blog Entries: 8

Rep: Reputation: 362Reputation: 362Reputation: 362Reputation: 362
Try something similar to this:
Code:
/dev/sda1 /mnt/usbflash vfat rw,users,uid=500,gid=500,umask=022 0 0
Replace "500" with your uid, gid.
 
Old 08-12-2017, 07:45 PM   #4
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,573
Blog Entries: 15

Rep: Reputation: Disabled
Let the user mount it?
Code:
/usr/bin/udisksctl mount -b /dev/sda1 /media/fred/quarry > /dev/null 2>&1
Anything after /media/fred/ is arbitrary and is not a fixed point. It does not have to "exist"
Fred will full permission. No chmod/chown nonsense.

Last edited by Habitual; 08-12-2017 at 07:49 PM.
 
Old 08-13-2017, 02:02 AM   #5
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 3,120

Rep: Reputation: 549Reputation: 549Reputation: 549Reputation: 549Reputation: 549Reputation: 549
You can specify permissions for the mount in fstab. But it's better to specify permissions in the file system.
 
Old 08-13-2017, 03:38 AM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 2,278
Blog Entries: 8

Rep: Reputation: 362Reputation: 362Reputation: 362Reputation: 362
Since it's vfat (fat32 or fat16), specifying file permissions in the file system isn't an option.
 
  


Reply


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
[SOLVED] Cannot Mount USB Flash Drive Under FSTAB Steve R. Linux - Software 3 03-24-2013 12:54 PM
Fstab fat32 --> writable by all users jasone Linux - Newbie 3 12-14-2010 03:16 AM
Setting user mountpoint permissions in fstab without uid, umask, etc. michapma Linux - General 2 01-30-2010 12:48 PM
Edit fstab file to make USB disk writable. AGazzaz Linux - General 2 07-10-2008 06:18 PM
fstab, automount usb flash HPB Linux - Newbie 10 05-31-2006 06:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:55 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration