Re: Make Debian automount mount devices in read only
On Thu 03 Mar 2022 at 10:00:09 +0100, Carles Pina i Estany wrote:
>
> Hi,
>
> My desktop computer (Debian 11.2) auto-mounts USB devices (hard disks,
> etc.)
>
> 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 :-)
I have a USB stick containing audio files and in /etc/fstab there is
LABEL=MUSIC-1 /media/MUSIC-1 vfat ro,gid=1000,fmask=0117,dmask=0007,noatime,noauto,user,x-systemd.automount,x-systemd.idle-timeout=5,x-systemd.device-timeout=1 0 0
Mounting takes place only when the decice is accessed.
* x-systemd.automount: mounts /media/MUSIC-1 when a command wants
to access it.
* systemd.idle-timeout: unmounts the partition a specified time
period after the calling program ceases to access it.
* noauto: causes /media/MUSIC-1 not to be mounted while the machine
is booting.
* x-systemd.device-timeout: configures how long systemd should wait
when no device is plugged in or an incorrect device is found.
I haven't any idea how this fits in with having udisks on the system or
remounting a disk rw, or even how it fits your objectives.
--
Brian.
Reply to: