LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 12: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, 12:48 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,253

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
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 12:50 PM.
 
Old 08-12-2017, 12:49 PM   #3
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
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, 06:45 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

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 06:49 PM.
 
Old 08-13-2017, 01:02 AM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

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

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


Reply



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 11:54 AM
Fstab fat32 --> writable by all users jasone Linux - Newbie 3 12-14-2010 02:16 AM
Setting user mountpoint permissions in fstab without uid, umask, etc. michapma Linux - General 2 01-30-2010 11:48 AM
Edit fstab file to make USB disk writable. AGazzaz Linux - General 2 07-10-2008 05:18 PM
fstab, automount usb flash HPB Linux - Newbie 10 05-31-2006 05:35 PM

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

All times are GMT -5. The time now is 04:06 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
Open Source Consulting | Domain Registration