External hard disk that requires the password to be mounted

Hello there… and I hope it’s the right section of the forum for the topic.

I’m new to EndeavourOS, with Plasma5 (even if as a derivative of Arch I already have a good experience with Manjaro) and I immediately found the problem clearly stated in the title.

Fresh installation of EndeavourOS on ssd, 120 GB kingston, and second hard disk, a brand new 2 TB seagate barracuda, formatted in ext4, because originally it had to contain the separate home (but then I decided on a simpler set of links, between the home folders and those in the external hard drive, as I had already done on Manjaro and KDE Neon).

On first mount, it asks for my password, and I immediately notice that it was read-only for normal “non-root” users.
I use root permissions to change hard disk permissions, it is now readable and writable by the normal user.
However, even if I put the automatic mounting and “activated” a script on purpose (also used with the other aforementioned distros, Manjaro and Neon), but, even if it mounts it at startup, it keeps asking me for the password (this time at startup of the system).

This has never happened to me, and I would like to know if there is a way to fix it (which doesn’t involve formatting the drive because, well, it was urgent that I use it and there is already a hundred GB of documents that I have no way to move).

PS: forgive my english … but i’m using google translate.

Hi Kasull, welcome.

Please clarify, how is the “external” hard disk attached to your system? Is it mounted automatically at startup (because it has an entry in /etc/fstab)? Or is it a attached device (e. g. usb-enclosure)? …

With the device attached and mounted, please run the following commands and post the results:

  • lsblk -mp

  • findmnt | grep ext4

  • cat /etc/fstab | grep -v '#'

So for the automount at boot, I used this little script (inserted between the entries in autostart in system settings):

#!/bin/sh
gvfs-mount -d /dev/sdb1

And, in addition checked the automatic mounting of the disk (system settings, removable devices) … because alone this entry does not work.

The password has asked me since the first format, performed with Mintstick and in a shell to use it as an external hard drive.

Here is the required output (my other 500GB external hard drive is also present):

[omar@EnveavourOS ~]$ lsblk -mp
NAME          SIZE OWNER GROUP MODE
/dev/sda    111,8G root  disk  brw-rw----
├─/dev/sda1   300M root  disk  brw-rw----
├─/dev/sda2   104G root  disk  brw-rw----
└─/dev/sda3   7,5G root  disk  brw-rw----
/dev/sdb      1,8T root  disk  brw-rw----
└─/dev/sdb1   1,8T root  disk  brw-rw----
/dev/sdc    465,8G root  disk  brw-rw----
└─/dev/sdc1 465,8G root  disk  brw-rw----
[omar@EnveavourOS ~]$ findmnt | grep ext4
/                                     /dev/sda2  ext4            rw,noatime
│ ├─/run/media/omar/HomeExterna       /dev/sdb1  ext4            rw,nosuid,nodev,relatime
[omar@EnveavourOS ~]$ cat /etc/fstab | grep -v '#'
UUID=8A20-FE67                            /boot/efi      vfat    umask=0077 0 2
UUID=f9d8f408-e9b3-4e2f-9686-b5bbc65ed83e /              ext4    defaults,noatime 0 1
UUID=99665053-3350-4a54-907b-698e10f5948a swap           swap    defaults,noatime 0 2
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
[omar@EnveavourOS ~]$ 

If you’re going to mount at each boot anyway, why use a script and not add the drive to /etc/fstab?

Mounting through fstab should get rid of the requirement to enter your user password.

  1. Remove your script from the autostart section.

  2. Create a mountpoint
    sudo mkdir /mnt/HomeExterna

  3. Open /etc/fstab in editor
    sudo leafpad /etc/fstab

  4. Add (at least) the following line …
    /dev/sdb1 /mnt/HomeExterna ext4 defaults 0 2
    -OR- (recommended) …
    /dev/sdb1 /mnt/HomeExterna ext4 defaults,noauto,x-systemd.automount,user,noatime 0 2

  5. Save the file & reboot

With the second option the drive will only be mounted when you access it and you shouldn’t be asked for a password.

5 Likes

Done … now it’s fully functional.

5 Likes