Help with udisks2 and automounting a certain thumb drive as read-only.

Thomas Gläßle t_glaessle at gmx.de
Fri Jan 27 14:04:38 UTC 2017


Hey,

I'm not sure whether I'm the right person to answer, but here is my few
attempt:

It really depends on how you want to mount. Say you are using udiskie
[1], you can put a rule in the config file, to specify your device as
readonly, like this:

~/.config/udiskie/config.yml:

    mount_options:
    - id_uuid: E457-0FC9
      options: [ro]

where you have to put the UUID of your filesystem.

(disclaimer, I'm the maintainer of udiskie)

If you want to keep a simpler solution with an udev rule, which tool do
you use for mounting - udisksctl? In this case: `udisksctl mount`
accepts a parameter `--options=ro` to achieve the same.

You could show me your current rule and script, so we can figure out how
to modify that.


Best, Thomas


[1]: https://github.com/coldfix/udiskie




Spork Schivago wrote on 01/21/2017 07:42 PM:
> Hello,
>
> I sent this message yesterday after signing up to the mailing list,
> but I sent it before I got the Welcome to the "devkit-devel" mailing
> list e-mail, so I'm not sure it actually went through.
>
> I found this mailing list when I was searching for what I wanted to
> accomplish.   I saw someone was submitting a patch to accomplish what
> I wanted to accomplish, however, the patch wasn't accepted (for
> various reasons).   I thought maybe the fellow members could help me
> or point me in the right direction so I can get help for my problem.  
> I'm not certain that this is the proper mailing list to ask for help,
> and if it's not, I apologize.   Perhaps someone could show me a more
> fitting mailing list?
>
> I want a certain thumb drive to always auto-mount as read-only, but
> only that thumb drive.   I tried writing a custom udev rule and I got
> it to the point where I inputed just that thumb drive, it'd execute a
> script.   When I removed it, it'd execute another script.   I tried
> calling mount and unmount from those scripts, I tried using udisksctl
> to mount the thumb drive, but they don't work at that stage of the
> process and fail.
>
> I followed a tutorial on Arch Linux's website that says how to use
> mount in a udev rule, by changing MountFlags to shared in some file
> called systemd-udev.service or something like that.   That didn't
> allow me to use the mount command.    The most important part is the
> thumb drive needs to mount under the /run/media/<username>/<fs label>.
>   I really want that.    Otherwise, I could just setup an fstab entry.
>
> Does anyone know how to accomplish what I want to accomplish?    I'm
> running OpenSuSE Tumbleweed and Gnome.   I believe I have udisks2
> installed.   I'm fairly new to this, so again, I apologize if I'm not
> providing the right information.
>
> Thanks!
>
> Ken Swarthout
>
>
> _______________________________________________
> devkit-devel mailing list
> devkit-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/devkit-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/devkit-devel/attachments/20170127/0dd30cef/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/devkit-devel/attachments/20170127/0dd30cef/attachment.sig>


More information about the devkit-devel mailing list