Make A Donation



udevil At A Glance

About udevil is a command line Linux program which mounts and unmounts removable devices without a password, shows device info, and monitors device changes. It can also mount ISO files, nfs://, smb://, ftp://, ssh:// and WebDAV URLs, and tmpfs/ramfs filesystems.
  • Intended as a hassle-free replacement for udisks
  • Highly configurable & security conscious
  • Requires no daemon running
  • To use it, just prefix a normal mount command with 'udevil'
  • Can replace udisks in the SpaceFM file manager and the devmon automounting daemon (devmon is included with udevil)
  • More Highlights
Depends
  • udev or eudev
  • glib
udevil (& SpaceFM) can be used completely without systemd, consolekit, policykit, dbus, udisks, gvfs & fuse (although it can coexist with any of these).
Install
Docs
Sites



Highlights

  • Lightweight - Written in C with libudev and glib - no dependency on udisks or gvfs
  • Users can specify custom mount points and mount options
  • Optional user mounting of nfs://, smb://, ftp://, ssh:// and WebDAV network URLs with support for username, password, port, and any other configured options
  • Optional user mounting of image files (ISO, etc)
  • Uses mount's existing command line usage - just prefix your mount command with 'udevil'. Also supports udisks v1 and v2 command line usage
  • Flexible - Admins can easily adjust allowed users, groups, fstypes, devices, and networks, and set default mount options and allowed mount options for each fstype, with exceptions for special users
  • Extensible - Allows admins to use additional custom authentication and notification scripts
  • Secure - Designed to limit user actions to only what you want enabled, plus easily log all system-wide uses of udevil
  • Detailed errors and verbose commands for quick troubleshooting
  • Works as SpaceFM's mount/unmount command, replacing need for pmount or udisks
  • Includes and works as a udisks v1 replacement for the devmon automounting daemon

Limitations

  • udevil does not handle encrypted devices automatically





 

Installer

A self-extracting installer is available in Downloads (click on a file and click View Raw to download). The installer MUST be run in a terminal. It automatically builds and installs, and should work with any recent distro. Run it like this:

bash udevil-x.x.x-installer.sh

# or to see options:

bash udevil-x.x.x-installer.sh --help

The installer requires the build dependencies listed in the README file. Build dependencies include: (package names may vary on your distro)

libglib2.0-0 libglib2.0-dev libudev0 (>=143) libudev-dev autotools-dev build-essential fakeroot intltool pkg-config

Also recommended for network support: cifs-utils curlftpfs sshfs davfs2

Also recommended if using devmon: eject zenity

If any dependencies are missing, examine the error, install missing packages, and try again.

To reinstall or upgrade, just run the latest installer again.

For easy manual build instructions please see the README file.

To authenticate downloads see authentication instructions.

NOTE: Also see Post Installation steps below.


 

Post Installation

Kernel Polling

Older Distros: You may need to enable kernel polling for device media to be detected by udevil. See the Enable Kernel Polling section below.

Networks and Files

By default, /etc/udevil/udevil.conf is set to allow only local fileystems and ISO files to be mounted, with mounting of networks disallowed. To allow networks and files to be mounted, in /etc/udevil/udevil.conf set:

    allowed_types = $KNOWN_FILESYSTEMS, file, cifs, nfs, curlftpfs, sshfs, davfs
You may also need to install curlftpfs or ftpfs (ftp://), cifs-utils or smbfs (smb://), sshfs (ssh://), and davfs2 (http://).

NTFS-3G

If local ntfs filesystems aren't mounted writable, you may need to configure your system to mount ntfs with ntfs-3g (on some distros this is already done). For example:

    sudo ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs

    # OR if mount.ntfs-3g is located in /usr/bin:
    sudo ln -s /usr/bin/mount.ntfs-3g /usr/bin/mount.ntfs

Set SUID

After installing udevil, /usr/bin/udevil should have the suid bit already set. If not, set it like this:

    sudo chown root:root /usr/bin/udevil
    sudo chmod u+s,go-s,ugo+x /usr/bin/udevil
    ls -l /usr/bin/udevil
        -rwsr-xr-x 1 root root 226625 May 22 08:13 /usr/bin/udevil
OR, to restrict execution of udevil to the 'plugdev' group only:
    sudo chown root:plugdev /usr/bin/udevil
    sudo chmod u+s,go-s,o-x /usr/bin/udevil
    ls -l /usr/bin/udevil
        -rwsr-xr-- 1 root plugdev 226625 May 22 08:13 /usr/bin/udevil
OR, if you don't want to use udevil for mounting, you can unset suid:
    sudo chown root:root /usr/bin/udevil
    sudo chmod ugo-s,ugo+x /usr/bin/udevil
    ls -l /usr/bin/udevil
        -rwxr-xr-x 1 root root 226625 May 22 08:13 /usr/bin/udevil
You can also limit users and groups by editing /etc/udevil/udevil.conf


 

Enable Kernel Polling

OLDER DISTROS: You may need to enable kernel polling for device media to be detected by udevil. For example, if you insert a CD and udevil's monitor command doesn't report a change to the device, or udevil doesn't see a filesystem on the device, this is a symptom that kernel polling is not enabled.

Kernel polling is a newer feature of the Linux kernel and udev, so some distros may not yet have it enabled by default. To use kernel polling, your Linux kernel may need to be 2.6.38 or newer, and udev may need to be version 173 or newer.

To determine if kernel polling is enabled:

    cat /sys/module/block/parameters/events_dfl_poll_msecs
    cat /sys/block/sr0/events_poll_msecs
If you get 0 or -1 from both of those commands, kernel polling may be disabled.

To enable kernel polling permanently (survives a reboot), add the following command to your /etc/rc.local file (anywhere before the 'exit' line in that file):

    echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs
Any number between 2000 and 5000 (milliseconds) should be reasonable - the higher 5000 means poll every 5 seconds, which is less overhead but a little slower.

OR pass this option to the kernel boot command line in grub:

block.events_dfl_poll_msecs=2000

OR add a udev rule to enable kernel polling on removable devices:

echo 'ACTION=="add", ATTR{removable}=="1", ATTR{events_poll_msecs}=="-1", ATTR{events_poll_msecs}="2000"' > /etc/udev/rules.d/61-removable-storage-polling.rules

A reboot will be required for the above changes to take effect, or...

To enable kernel polling temporarily and immediately, enable common polling for the block module:

    sudo bash -c 'echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs'

OR you can enable polling just for a single device like this (/dev/sr0 in this example):

    sudo bash -c 'echo 2000 > /sys/block/sr0/events_poll_msecs'
This change should be immediate - media will be detected. However, the above change will be lost when you reboot.

References:
linuxfromscratch.org
uam-can-now-mount-cds-and-dvds
bugs.archlinux.org
unix.stackexchange.com




Updated 2018-Jan-27
Make A Donation