https://bugs.kde.org/show_bug.cgi?id=510584

--- Comment #2 from Jonathan Farley <[email protected]> ---
(In reply to Nate Graham from comment #1)
> I have a LUKS-encrypted EXT4 drive that gets mounted as expected here.
> Perhaps the filesystem is relevant.
> 
> Are you clicking on the "Mount and Open" button in the Disks & Devices popup?

If you cick on 'Mount and Open' in the taskbar the response after the password
dialog is "You are not authorised to mount this device". 

If you click on the drive in the 'Places' section of dolphin, it brings up the
password dialog, then says the same. However at this point the drive is
unlocked, but not mounted. If you click on the drive in 'places', it just
brings up the enter password dialog each time.  - In KDE5, it would unlock and
mount and clicking on it again would open the drive.

To mount it after unlocking I have created this script:

#!/bin/bash

usage() {
    cat <<EOF
EncMount - Manage mounting and unmounting of unlocked LUKS-encrypted drives.

Usage:
  EncMount             Mount all unlocked but unmounted LUKS drives.
  EncMount -m          Explicitly mount all unlocked but unmounted LUKS drives.
  EncMount -u          Unmount and lock all currently mounted LUKS drives.
  EncMount -h          Show this help message.

Details:
  - Devices must already be unlocked (e.g., via Dolphin or manually).
  - Uses udisksctl to mount/unmount/lock without root permissions.
  - Only affects devices under /dev/mapper that are actual block devices.
  - Skips system devices like /dev/mapper/control.
  - Mounted volumes appear under /media/<user>/ as usual.

Examples:
  EncMount         # Automatically mount all decrypted but unmounted drives
  EncMount -u      # Unmount and lock all decrypted drives
  EncMount -h      # Show this help

EOF
    exit 0
}

mount_unlocked() {
    for dev in /dev/mapper/*; do
        if [ ! -b "$dev" ] || [[ "$dev" == *control ]]; then
            continue
        fi

        if mount | grep -q "$dev"; then
            echo "$dev is already mounted."
            continue
        fi

        echo "Attempting to mount $dev..."
        udisksctl mount -b "$dev"
    done
}

unmount_and_lock() {
    for dev in /dev/mapper/*; do
        if [ ! -b "$dev" ] || [[ "$dev" == *control ]]; then
            continue
        fi

        if mount | grep -q "$dev"; then
            echo "Unmounting $dev..."
            udisksctl unmount -b "$dev"
        fi

        echo "Locking $dev..."
        udisksctl lock -b "$dev"
    done
}

# Parse CLI options
case "$1" in
    ""|-m)
        mount_unlocked
        ;;
    -u)
        unmount_and_lock
        ;;
    -h)
        usage
        ;;
    *)
        echo "Unknown option: $1"
        usage
        ;;
esac

Which mounts the disc, but I have to navigate to /media to use them.

I have tried altering polkit rule (cat 10-udisks2-mount.rules) to:
/* Allow members of the 'plugdev' group to mount removable and system volumes
without auth */
polkit.addRule(function(action, subject) {
    if (subject.isInGroup("plugdev") && subject.local && subject.active) {
        if (action.id == "org.freedesktop.udisks2.filesystem-mount" ||
            action.id == "org.freedesktop.udisks2.filesystem-mount-system"
        ) {
            return polkit.Result.YES;
        }
    }
});
and added another rule (80-udisks2-user-unlock.rules):
/* Allow active local users to authenticate as themselves to unlock system
encrypted volumes */
polkit.addRule(function(action, subject) {
    if (subject.local && subject.active) {
        if (action.id == "org.freedesktop.udisks2.encrypted-unlock-system") {
            // Require authentication from the current user
            return polkit.Result.AUTH_SELF;
        }
    }
});

which I thought would cure it, but alas, no - I am still not authorised. I
suspect it is probably ntfs inside the encrypted disc, and I will try and make
up an ext4 disc at some point to try. But that doesn't get round my needing to
use encrypted ntfs on occasions.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to