pmount(1)

πŸ“¦
version 0.9.23 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

pmount β€” mount arbitrary hotpluggable devices as a normal user. bestie, no sudo, no /etc/fstab entry, no tears πŸ’…


✨ SYNOPSIS ✨

pmount [ options ] device

pmount [ options ] device label

pmount --lock [ options ] device pid

pmount --unlock [ options ] device pid

pmount

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so pmount (short for "policy mount", periodt) is a wrapper around the standard mount program. what it does is let normal users mount removable devices without needing a matching entry in /etc/fstab. iconic behaviour honestly πŸŽ€

it also handles encrypted devices that use dm-crypt and have LUKS metadata. if you've got a LUKS-capable cryptsetup installed, pmount will use it to decrypt the device first, and then mount the mapped unencrypted device instead. slay πŸ”βœ¨

you invoke it like this:

pmount device [ label ]

this mounts device to a directory below /media, if the policy is met (see the POLICY section, bestie, it's important). if you give a label, the mount point becomes /media/label; if you don't, it's /media/device. simple as 🫢

the device gets mounted with these flags, exactly these:

async,atime,nodev,noexec,noauto,nosuid,user,rw

now, some apps β€” CD burners, looking at you πŸ‘€ β€” modify a raw device, and that device must not be mounted while the burning process is running. to stop automatic mounting, pmount has a locking mechanism: pmount --lock device pid will prevent the pmounting of device until it's unlocked again with pmount --unlock device pid. the process id pid assigns the lock to a particular process, which is the whole point β€” it lets several processes lock one device at the same time.

during mount, the list of locks gets cleaned 🧹, i.e. every lock whose associated process doesn't exist anymore is removed. this prevents forgotten indefinite locks from crashed programs. no zombie locks here, no cap πŸ’€

running pmount with no arguments prints the list of mounted removable devices, a bit in the fashion of mount (1). cute lil status report fr fr πŸ“‹

please note that you can use labels and uuids as described in fstab (5) for devices present in /etc/fstab. in that case, the device name needs to match exactly the corresponding entry in /etc/fstab, including the LABEL= or UUID= part. exactly exactly. πŸ™ˆ

important note for Debian: the permission to execute pmount is restricted to members of the system group plugdev. please add all desktop users who shall be able to use pmount to this group by executing
adduser user plugdev

(as root). don't forget the root part, bestie 😭


πŸ‘‘ POLICY πŸ‘‘

the mount will succeed if all of the following conditions are met:

  • device is a block device in /dev/
  • device is not in /etc/fstab (if it is, pmount executes mount device as the calling user to handle this transparently). see below for more details.
  • device is not already mounted according to /etc/mtab and /proc/mounts
  • if the mount point already exists, there is no device already mounted at it and the directory is empty
  • device is removable (USB, FireWire, or MMC device, or /sys/block/drive/removable is 1) or whitelisted in /etc/pmount.allow.
  • device is not locked

πŸ’… OPTIONS πŸ’…

  • -r, --read-only β€” force the device to be mounted read only. if neither -r nor -w is specified, the kernel chooses an appropriate default. let the kernel cook 🍳
  • -w, --read-write β€” force the device to be mounted read/write. same deal: if neither -r nor -w is given, the kernel picks an appropriate default.
  • -s, --sync β€” mount the device with the sync option, i.e. without write caching. the default is async (write-back). heads up though: with this option, write operations are much slower, and because of the massive increase of updates of inode/FAT structures, flash devices may suffer heavily if you write large files. this option is intended to make it safe to just rip out USB drives without proper unmounting. chaotic but valid πŸ”₯
  • -A, --noatime β€” mount the device with the noatime option. default is atime.
  • -e, --exec β€” mount the device with the exec option. default is noexec.
  • -t filesystem, --type filesystem β€” mount as the specified file system type. the file system type is automatically determined if this option isn't given. see at the bottom for a list of currently supported filesystems πŸ‘€
  • -c charset, --charset charset β€” use the given I/O character set (default: utf8 if called in a UTF-8 locale, otherwise the mount default). this corresponds with the mount option iocharset (or nls for NTFS). this option is ignored for file systems that don't support setting the character set (see mount (8) for details). important note: pmount will now mount VFAT filesystems with iocharset=iso8859-1, as iocharset=utf8 currently makes the filesystem case-sensitive (which is pretty bad...). yeah. that one πŸ’€
  • -u umask, --umask umask β€” use the specified umask instead of the default one. for UDF the default is 000, for VFAT and NTFS the default is 077. this value is ignored for file systems which don't support setting an umask. note that you can use a value of 077 to forbid anyone else to read/write the files, 027 to allow your group to read the files, and 022 to allow anyone to read the files (but only you can write). pick your vibe ✨
  • --dmask dmask β€” the directory half of the split mask thing below, bestie πŸŽ€
  • --fmask fmask β€” some filesystems (essentially VFAT and HFS) support separate umasks (see the -u option just above) for directories and files, to avoid the annoying effect of having all files executable. for these filesystems, you can specify the masks separately using these options. by default, fmask is umask without all executable permissions and dmask is umask. most of the time these settings should just do what you want, so there should seldom be any need for using directly the --fmask and --dmask options. trust the defaults 🫢
  • -p file, --passphrase file β€” if the device is encrypted (dm-crypt with LUKS metadata), read the passphrase from the specified file instead of prompting at the terminal. no typing in public, we love to see it 🀫
  • -h, --help β€” print a help message and exit successfully. ✨
  • -d, --debug β€” enable verbose debug messages. for when you need the tea β˜•
  • -V, --version β€” print the current version number and exit successfully.

πŸŽ€ FILES πŸŽ€

  • /etc/pmount.allow β€” list of devices (one device per line) which are additionally permitted for pmounting. globs, such as /dev/sda[123], are permitted. see glob (7) for a more complete syntax. wildcards said slay 🌈

🌸 SEE ALSO 🌸

pumount (1), mount (8)


🧚 SUPPORTED FILESYSTEMS 🧚

for now, pmount supports the following filesystems: udf, iso9660, vfat, ntfs, hfsplus, hfs, ext3, ext2, ext4, reiserfs, reiser4, xfs, jfs and omfs. they are tried sequentially in that exact order when the filesystem is not specified. the order matters, bestie, don't rearrange it πŸ’…

additionally, pmount supports the filesystem types ntfs-fuse and ntfs-3g to mount NTFS volumes respectively with ntfsmount (1) or ntfs-3g (1). if the file /sbin/mount.ntfs-3g is found, then pmount will mount NTFS filesystems with type ntfs-3g rather than plain ntfs. to disable this behavior, just specify -t ntfs on the command-line, as this happens only for autodetection. iykyk 😌


πŸ’œ MORE ABOUT FSTAB πŸ’œ

pmount now fully resolves all symlinks both in its input and in the /etc/fstab file, which means that if /dev/cdrom is a symlink to /dev/hdc and you try to mount /dev/hdc directly, pmount will delegate this to mount (1). this is a feature, and it contrasts with previous unclear behavior of pmount about symlinks in /etc/fstab. glow-up behaviour honestly ✨


😭 KNOWN ISSUES 😭

though we believe pmount is pretty much free from security problems, there are quite a few glitches that probably will never be fixed. not everything can be perfect, bestie πŸ’”

  • pmount needs to try several different times to mount to get the filesystem right in the end; it is vital that pmount does know which precise filesystem to mount in order to give it the right options not to cause security holes. this is rather different from the behaviour of mount with the -t auto options, which can have a look at the device it is trying to mount and find out what its filesystem is. pmount will never try to open a device and look at it to find out which filesystem it is, as it might open quite a few security holes. moreover, the order in which the filesystems are tried is what we could call the most commonly used filesystems on removable media. this order is unlikely to change as well. in particular, that means that when you mount an ext3 filesystem using pmount, you might get a lot of fs-related kernel error messages. sorry ! πŸ™ˆ
NOTE: starting from version 0.9.17, pmount uses the same mechanism as mount (1) to autodetect the filesystem type, so this kind of problems should not happen anymore. we ate that fix up πŸ”₯

πŸ‘‘ AUTHOR πŸ‘‘

pmount was originally developed by Martin Pitt <martin.pitt@canonical.com>. it is now maintained by Vincent Fourmond <fourmond@debian.org>. legends only 🫢


and that's the whole page, bestie πŸŽ€ this was the pmount(1) page from the General Commands Manual, dated August 27, 2004, originally written down by Martin Pitt β€” go forth and mount responsibly, mwah πŸ’…βœ¨