以普通用户身份安装和卸载 UDF .iso 图像

Jor*_*eña 1 iso mount unmounting fuse

fuseiso不久前发现,但我需要安装 UDF 图像,并且fuseiso在我尝试安装 UDF 图像失败后似乎不支持它。我需要能够以普通用户身份对任意图像执行此操作,并且我也必须能够卸载它们,最好将挂载点范围限定在特定用户目录内(假设这不是问题,例如/home/user/mounted/*),所以直接使用mount是不行的。有没有办法做到这一点?

我在 Ubuntu 上,在调查这个问题时我发现了pmount但它似乎不符合我的需求,因为 1) 我正在尝试挂载.iso文件而不是/dev块设备 2) 我将无法挂载它在用户位置(这样我就可以作为用户卸载它,例如使用fusermount -u它是否是保险丝 fs)。

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
Run Code Online (Sandbox Code Playgroud)

什么是任何我有选择吗?在我想象的最糟糕和最令人沮丧的情况下,作为最后的手段,我将能够编写自定义 setuid 脚本来完成此任务?不过我希望我不必冒这个险。

小智 6

udisksctl loop-setup -f /full/path/to/iso从 udisks2 包中使用它。

udisksctl loop-setup -f /media/myname/dvd/avatar/buch-1/AVATAR_BK1_VOL1_EUR.iso
    Mapped file /media/myname/dvd/avatar/buch-1/AVATAR_BK1_VOL1_EUR.iso as /dev/loop1.
Run Code Online (Sandbox Code Playgroud)

它将iso 安装在/media/$USER/ 中。

如果没有,您还需要输入 udisksctl mount -b /dev/loop1

$ mount | grep udf
/media/myname/dvd/avatar/buch-1/AVATAR_BK1_VOL1_EUR.iso on /media/myname/AVATAR_BK1_VOL1_EUR type udf (ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,uhelper=udisks2)
Run Code Online (Sandbox Code Playgroud)

卸除与udisksctl unmount -b /dev/loop1如果ISO被定位在/ dev / LOOP1。

也应该在没有 gui 的情况下工作。