LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-16-2021, 08:43 AM   #1
peter7089
Member
 
Registered: May 2016
Distribution: MX Linux
Posts: 249

Rep: Reputation: Disabled
How to mount partitions as my user in fstab?


I have two encrypted partitions and i use these two lines in fstab to mount them on boot:

Code:
/dev/mapper/data1 /media/data1 ext4 defaults 0 2
/dev/mapper/data2 /media/data2 ext4 defaults 0 2
But they are mounted as root. How to mount them as my user and group?
 
Old 12-16-2021, 08:53 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
See Non-superuser mounts in the man page of mount.
 
Old 12-16-2021, 08:53 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
what's wrong with that? I guess you have permission problems, you only need to change them (just I don't know which one).
 
Old 12-16-2021, 10:11 AM   #4
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
All that is needed for user access is to change the ownership of the mount point and possibly the data inside. Having root do the mount is perfectly normal.

For example, with the devices mounted, do
Code:
sudo chown username:usergroup /media/data1
If you want that to apply to everything on that device add the -r option to the chown command. Repeat for the second mount point and you should be done.
 
Old 12-16-2021, 10:59 AM   #5
peter7089
Member
 
Registered: May 2016
Distribution: MX Linux
Posts: 249

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by computersavvy View Post
All that is needed for user access is to change the ownership of the mount point and possibly the data inside. Having root do the mount is perfectly normal.

For example, with the devices mounted, do
Code:
sudo chown username:usergroup /media/data1
If you want that to apply to everything on that device add the -r option to the chown command. Repeat for the second mount point and you should be done.
This worked. I thought after reboot the ownership will be reversed to root, but so far it is preserved.
 
  


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] Fstab fails to mount second hard drive to /run/media/$USER: "mount point does not exist". MurderousMincePie Linux - Newbie 3 10-10-2017 06:41 AM
Can't mount partitions from HDA, But will mount partitions from HDB Colonel-1990 Linux - Hardware 13 08-09-2008 09:59 AM
fstab problem: mount: can't find dvd in /etc/fstab or /etc/mtab Nikon01 Slackware 5 11-17-2006 06:15 AM
Partitions, partitions, partitions..... Clueless in VA Linux - Newbie 7 08-08-2001 03:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:05 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