You are not logged in.

#1 2017-12-12 17:50:40

rinzler
Member
Registered: 2017-07-27
Posts: 16

[SOLVED]Non-root users mount ext4 filesystem..

Hello ,

My hard disk is partitioned into several disks. in that I need some of them to mount without root password, and some of them to mount by asking root password. I edited fstab file to do so. But It is not possible to mount them without root password.

My fstab file looks like this..

# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# /dev/sda3
LABEL=ROOT	/         	ext4      	rw,relatime,data=ordered	0 1

# /dev/sda1
LABEL=BOOT	/boot	vfat	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 2

# /dev/sda2
LABEL=SWAP	none      	swap      	defaults  	0 0

# /dev/sda4
LABEL=EMPTY /home/krishna/EMPTY ext4 rw,suid,dev,exec,noauto,user,async	0	0

# /dev/sda5
LABEL=ENTERTAINMENT    /run/media/krishna/ENTERTAINMENT    ext4 rw,suid,dev,exec,noauto,user,async    0    0

# /dev/sda6
LABEL=DOCS	/run/media/krishna/DOCS	ext4	rw,suid,dev,exec,noauto,user,async	0	0

# /dev/sda7
LABEL=MINE	/run/media/krishna/MINE	ext4	rw,suid,dev,exec,noauto,nouser,async	0	0

# /dev/sda8
LABEL=FILES	/run/media/krishna/FILES	ext4	rw,suid,dev,exec,noauto,nouser,async	0	0

Disks should be mounted without root password are LABELS: DOCS,EMPTY,ENTERTAINMENT
Disks should be mounted with root password are LABELS: FILES,MINE

My disks Default mounting path is :  /run/media/krishna/media/DISK-LABEL
In that /run is there in the filesystem. Rest of the path is created when I mounted them..

I searched alot about mounting file systems as non-root.
some of them says that as you want to mount your disks as rw mounting directory needs to have permissions rwx for that specified user.

Now my question is mouting directory /run didn't have rwx permissions for my user. Should I change its own or group to have rwx permissions?? Doing so will create any security flaws ?? or should change my disks  mounting path to /home/username/DISK-LABEL???


EDIT ::
I used gid, uid, umask in options but it didn't worked...

Last edited by rinzler (2017-12-14 10:57:09)

Offline

#2 2017-12-13 10:51:44

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,304

Re: [SOLVED]Non-root users mount ext4 filesystem..

What command do you use to mount for example the ENTERTAINMENT partition?
Because then, using fstab, the '/run/media/krishna/ENTERTAINMENT' directory has to exist before running the command.
How do you create it, as /run is a tmpfs partition which is cleared at each reboot?

rinzler wrote:

my question is mouting directory /run didn't have rwx permissions for my user. Should I change its own or group to have rwx permissions??

No you don't need to change permissions of /run, but you need only have 'owner, group, mod' of the user on the mount point, ie the /run/media/krishna/ENTERTAINMENT directory.
But could you clarify what exactly is the problem with what commands, please.

Offline

#3 2017-12-13 10:57:12

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED]Non-root users mount ext4 filesystem..

Wouldn't it be easier to always have all of the partitions mounted, and then just use permissions to control access?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2017-12-14 10:51:58

rinzler
Member
Registered: 2017-07-27
Posts: 16

Re: [SOLVED]Non-root users mount ext4 filesystem..

Thank you..

What I asked is My Entertainment, Docs, Empty partitions should be mounted without sudo or root privilages. But other paritions should ask root password to mount..
When I mount them using Terminal using `mount` everything happended correctly. But when I click on the sidebar options in nemo all of them are asking root password.
So I searched again and found the answer.I added current users to the udisksctl rule so that he won't be needed to type password to mount disks by clicking devices in sidebar of nemo..

At the same I added authorization option to DOCS, FILES in fstab. So when clicking DOCS,FILES it asks for root password.

I got it.
Thank you......

Offline

Board footer

Powered by FluxBB