xfce4-mount-plugin

Olivier Duchateau duchateau.olivier at gmail.com
Mon Mar 4 20:20:46 UTC 2013


2013/3/4 Jason Bacon <jwbacon at tds.net>:
>
> I maintain and develop sysutils/desktop-installer, which began as a simple
> script for setting up XFCE, until I realized that 99% of what it does is
> desktop-independent, so now it supports most common desktops.
>
> Now that xfce4-mount-plugin is available, I'm working on getting CD and
> flash drive mounts working out-of-the-box for members of the operator group.
>
> It's almost there if the following steps are taken:
>
> 1) Install the following in sudoers.d/mounts:
>
> %operator ALL=(ALL) NOPASSWD:  /sbin/mount /dev/cd0, /sbin/umount /dev/cd0,
> /sbin/mount /media/cdrom0, /sbin/umount /media/cdrom0, /sbin/mount /dev/cd1,
> /sbin/umount /dev/cd1, /sbin/mount /media/cdrom1, /sbin/umount
> /media/cdrom1, /sbin/mount /dev/da0a, /sbin/umount /dev/da0a, /sbin/mount
> /media/flash_ufs, /sbin/umount /media/flash_ufs, /sbin/mount /dev/da0s1,
> /sbin/umount /dev/da0s1, /sbin/mount /media/flash_fat, /sbin/umount
> /media/flash_fat, /sbin/mount /dev/da0s1, /sbin/umount /dev/da0s1,
> /sbin/mount /media/flash_ntfs, /sbin/umount /media/flash_ntfs
>
> An alternative to sudo would be to change the ownership of the mount points
> when a user logs in under XFCE and enable vfs.usermount.  This avoids the
> need for sudo, but limits mounting to users on the console, which is
> probably OK.
>
> 2) Add the appropriate fstab entries
>
> 3) Configure xfce4-mount-plugin for each user.
>
> 4) Put the following in /usr/local/etc/gamin/gaminrc to that gam_server
> doesn't prevent umounts:
>
> poll /media/cdrom0
> poll /media/cdrom1
> poll /media/flash_ufs
> poll /media/flash_fat
> poll /media/flash_ntfs
>
> I'd like to find a way to eliminate step 3, so that mounting just works for
> all users in the operator group.
>
> From my investigation so far, I've found 2 possibilites:
>
> 1) Install an appropriate xfce4-mount-plugin-??.rc in
> /usr/local/etc/xdg/xfce4/panel that adds sudo to the mount commands.  This
> file will probably be version-specific, so it will have to be regenerated
> with every upgrade of the plugin.
>
> or
>
> 2) Patch the source files with the following:
>
>         sed -i '' -e 's|"mount %d"|"sudo mount %d"|g' \
>             -e 's|"umount %d"|"sudo umount %d"|g' \
>             work/xfce4-mount-plugin-*/panel-plugin/mount-plugin.h
>
> The above only changes the default custom command, but does not affect the
> built-in default if custom commands are not selected.  I haven't figured out
> how to fix this yet.

User can modify mount and umount command, see preferences dialog.
In order to, if usermount is set, user can use mount command without sudo.

xfce4-mount-plugin reads mount points from /etc/fstab, it can't mount
new devices. If you need plugin wich detects new devices like CDRom,
USB stick, ...., i think you must use xfce4-genmon-plugin with your
own shell script or sysutils/automounter.

If you known C, you can also look to GIO (it's part of GLib) [1],
there're functions for mount devices.

[1] http://developer.gnome.org/gio/2.28/volume_mon.html

>
> I also added the following patch, although I'm still uncertain whether it's
> a better default:
>
>         sed -i '' -e \
>             's|on_mount_cmd = g_strdup("")|on_mount_cmd = g_strdup("thunar
> %m")
>             work/xfce4-mount-plugin-*/panel-plugin/mount-plugin.c

You can also use g_spawn_command_line_sync() function [2].

[2] http://developer.gnome.org/glib/2.28/glib-Spawning-Processes.html#g-spawn-command-line-sync

>
> Would you be amenable to changing the default behavior of the port to
> eliminate the need for users to do manual configuration?  If not, I'll do
> some sort of workaround in desktop-installer.

Before, report your patch upstream.

>
> Regards,
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Jason W. Bacon
> jwbacon at tds.net
> http://personalpages.tds.net/~jwbacon
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> _______________________________________________
> freebsd-xfce at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-xfce
> To unsubscribe, send any mail to "freebsd-xfce-unsubscribe at freebsd.org"



-- 
olivier


More information about the freebsd-xfce mailing list