Mount internal device without needing password?

Archived topics about LMDE 1 and LMDE 2
Locked
Merenguey

Mount internal device without needing password?

Post by Merenguey »

Hi guys,


Sorry for my misunderstanding, but I'd like to do the contrary : skip password when mounting an internal device.

Exactly, I have two sessions on my LMDE 201303 : a root and a standard session. With the standard session, I'd like to mount an internal device (unassigned, i.e. not "/" nor "/home"). Everytime I want to mount it, root password is asked. The thing is I'd like to automount this device which I can't.


Any ideas ?


Merenguey
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
jahid

Re: How to mount internal device without needing password?

Post by jahid »

you can edit the /etc/fstab file for automount
sudo gedit /etc/fstab
add the follwing line for each drive to automount at startup:
/dev/sdax /media/user/label ntfs defaults 0 0
x in 'sdax' depends on the drive.u can check it with the 'Disks' application
user= your user name
label= drive label
ntfs will be replaced by the type of the drive.
Merenguey

Re: How to mount internal device without needing password?

Post by Merenguey »

Thanks for the answer. To be precise, this internal device was configured during the initial partition (i.e. installation). That's why a root password is required to mount it. But what I'd like is to remove the password request to mount it.

Anyway, I did the /etc/fstab handling and it worked for both my normal & my root session. BUT if I unmount the device, it is impossible to mount it again, no matter the session nor the reboot :
Error mounting : mount exited with exit code 1 : helper failed with:
mount: only root can mount /dev/sda7 on on /media/path-to-the-folder
So, IMHO, it can only work once, which is not a very great thing... :|


So, how can I remove the password request when I mount this logical partition ? I don't think gparted can, even though it was implied during the initial partitioning process.
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: How to mount internal device without needing password?

Post by altair4 »

This is a very confusing topic since if you originally had an entry in fstab it shouldn't be asking you for sudo authority to mount since it's already mounted and I have no idea why one wants to unmount a partition that is automounted at boot but you might want to post the output of the following commands so people here can see how you are set up:

Code: Select all

cat /etc/fstab

Code: Select all

sudo blkid -c /dev/null
I try to stay out of LMDE as much as I can but with the info provided above it may help others help you.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Merenguey

Re: How to mount internal device without needing password?

Post by Merenguey »

Hi,


Sorry I see I didn't explain well. What I'm doing is configuring a linux computer for my family. In order to avoid any mess up, I prefer to keep control of the root session and let my family use the standard session. I need to automount an internal device at startup but, I don't know why, a sudo authority is required (on my linux mint 15 I have the same config and I can mount it without any sudo authority).

So, when I edited the /etc/fstab, I mounted it manualy before, then copy-pasted the /etc/mtab output in the /etc/fstab. In this way, when computer is restarted, it has already the automounting. Like this, everything can work.

BUT, just in case, I would not like that anyone could unmount the device and start messing. I live far from them and couldn't work on the computer.

Basicaly, my need is to know how to mount the device without any sudo authority (and if possible understand why damn this device require a sudo authority with LMDE). Like this, if unfortunatly the device is unmounted, it won't cause any problem when restarted. At first, I though it had something to see with permission, so I gave device's ownership to my standard session. But it's still useless in case of bad handling.


Here what asked :

cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=77df698b-3a93-47ec-9af0-7868da63ff94 /boot ext3 rw,errors=remount-ro 0 0
# /dev/sda5
UUID=b48e062b-d5ca-48f8-ac4e-de5c5a6b28d4 swap swap sw 0 0
# /dev/sda6
UUID=e92d7af0-0858-4af5-92c1-80095fa3a75b / ext4 rw,errors=remount-ro 0 1
rw,nosuid,nodev,relatime,user_xattr,barrier=1,data=ordered 0 0
sudo blkid -c /dev/null
/dev/sda1: UUID="77df698b-3a93-47ec-9af0-7868da63ff94" TYPE="ext3"
/dev/sda5: UUID="b48e062b-d5ca-48f8-ac4e-de5c5a6b28d4" TYPE="swap"
/dev/sda6: UUID="e92d7af0-0858-4af5-92c1-80095fa3a75b" TYPE="ext4"
/dev/sda7: UUID="efdf9613-2f7e-4699-9a15-2aafe2cf66a3" TYPE="ext4"
The /dev/sda7 device is the one involved.
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: How to mount internal device without needing password?

Post by altair4 »

So why not just create a mount point at say ... /mnt/Data and have the partition auto mount at boot by adding a line to the end of fstab:

Code: Select all

UUID=efdf9613-2f7e-4699-9a15-2aafe2cf66a3 /mnt/Data ext4 defaults,noatime 0 2
*** No password is required to mount that partition since root mounts it at boot.
*** Only someone who has sudo authority can unmount that partition and your "regular" users have no such authority.
*** And for the user that has sudo authority he has no need to unmount it.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Merenguey

Re: How to mount internal device without needing password?

Post by Merenguey »

Let me have a try but thanks anyway. Seems a good one. :D


M.
kurotsugi

Re: How to mount internal device without needing password?

Post by kurotsugi »

if those doesn't satisfy you, you can try this one. open /usr/share/polkit-1/action/org.freedesktop.udisk2.policy and look into

Code: Select all

<action id="org.freedesktop.udisks2.filesystem-mount-system">
scroll down a litle bit and you'll see

Code: Select all

<defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>
you'll need to change the value to yes

Code: Select all

<defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>
the change work after logout.
Merenguey

Re: How to mount internal device without needing password?

Post by Merenguey »

Thanks everyone, problem's solved ! I picked kurotsugi's solution (it was what I was looking for).

Just one last thing, what about unmounting the device ? Because with this solution, my standard session can unmount the device anytime without any authorisation. Because for 1 hour I'm doing everything but succeeding... :x

How could I add a specification :
if anyone want to mount it : no sudo authority => this one is okay
if anyone want to unmount : sudo authority => this one ain't


(I promise this is the last question :mrgreen: ).


M.
kurotsugi

Re: Mount internal device without needing password?

Post by kurotsugi »

I'm afraid we can't do that.

Code: Select all

<action id="org.freedesktop.udisks2.filesystem-unmount-others">
this part only gives password when the disk is mounted by another user.
User avatar
sdibaja
Level 5
Level 5
Posts: 900
Joined: Sun May 08, 2011 12:57 pm
Location: Baja California, Mexico

Re: How to mount internal device without needing password?

Post by sdibaja »

kurotsugi wrote:if those doesn't satisfy you, you can try this one. open /usr/share/polkit-1/action/org.freedesktop.udisk2.policy and look into

Code: Select all

<action id="org.freedesktop.udisks2.filesystem-mount-system">
scroll down a litle bit and you'll see

Code: Select all

<defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>
you'll need to change the value to yes

Code: Select all

<defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>
the change work after logout.
I am trying to automount by editing fstab also. I have done it with several distros with no issues, but with LMDE Update Pack 8 it does not work.
I have this path: /usr/share/polkit-1/actions
containing these 2 files:org.freedesktop.udisk2.policy and org.freedesktop.udisk.policy

If I make the edit to "yes" on either or both it does not work.

I can mount with the file manager, but it asks for password.
My use if for LuckBackup. BTW: even if mounted with file manager LuckyBackup says the drive in not mounted

confounded here
Peter
Mate desktop https://wiki.debian.org/MATE
Debian GNU/Linux operating system: https://www.debian.org/download
kurotsugi

Re: Mount internal device without needing password?

Post by kurotsugi »

If I make the edit to "yes" on either or both it does not work.

I can mount with the file manager, but it asks for password.
My use if for LuckBackup. BTW: even if mounted with file manager LuckyBackup says the drive in not mounted
you need to uninstall one of them. in my case I choose to uninstall udisk and leave udisk2.
Locked

Return to “LMDE Archive”