[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Make Debian automount mount devices in read only



On Thu 03 Mar 2022 at 10:00:09 (+0100), Carles Pina i Estany wrote:
> 
> My desktop computer (Debian 11.2) auto-mounts USB devices (hard disks,
> etc.)

That doesn't help a great deal because there are several automounters
available in Debian.

> I would like the devices to be mounted in read only mode by default. I
> will remount them in rw if I need to.
> 
> They are not in my /etc/fstab
> 
> I've been looking at udev configuration files, rules, etc. but I'm
> unsure which is the best way to go.
> 
> Is anyone here a bit more familiar with udev, systemd, etc. let me know
> of a good approach please? The current Debian (and for many versions)
> worked so well for me that I haven't dealt with this kind of settings,
> I don't know which is the right tool to setup or how they interact with
> eachother in detail anymore :-)

With Debian, I would guess that systemd is the way to go, because it's
probably best supported. You probably want to read pages such as:

https://www.freedesktop.org/software/systemd/man/systemd.automount.html
https://www.freedesktop.org/software/systemd/man/systemd.mount.html

(You should have local man copies, referring to the specific version
of systemd on Debian, not necessarily the latest.)

I've only used udev for creating mountpoints, as I don't believe
in automounting. I write my own rules files from scratch (man udev),
and there are copious examples in /lib/udev/rules.d/ to steal from.

As for the others, the wikis hint that you should probably leave them
alone, eg:

  AutoFs: "NB This information is likely outdated, usbmount does much
           of this automagically for most use cases."

  usbmount: USBmount is intended as a lightweight solution which is
            independent of a desktop environment. Users who like an
            icon to appear when an USB device is plugged in should
            use the pmount and hal packages instead. 

            Note (made in 2013): currently the author of the package
            is unable to maintain it and no one else has taken it on yet.

            For an appreciation of the present situation regarding
            usbmount development read this bug report and visit this
            repository. 

Of course if you use a DE then all bets are off because they may use
their own automounting scheme, qv, or something given above.

Cheers,
David.


Reply to: