如何在 openSUSE 13.2 中禁用外部设备的自动挂载?

如何在 openSUSE 13.2 中禁用外部设备的自动挂载?

之前我使用的是 openSUSE 11.4,并且有一个旧的手动挂载。尽管如此,我复制了所有配置文件(我认为),我注意到/etc/fstab设备未知是自动安装的(知道我定义为noauto)。但由于这在 openSUSE 13.2 发行版本中存在很大差异,因此我并不感到惊讶。

那么在 openSUSE 13.2 中如何做到这一点呢?我想通过 手动安装设备mount,并通过 手动卸载umount。没有其他办法,没有智能超时不活动或类似的事情。

我想在系统级别禁用该功能,每个桌面都不要禁用该功能(据记录,我使用 KDE 3.5,不是开玩笑),因此我可以 100% 确定在纯控制台或另一个桌面上工作时不会再次出现此问题。

相关问题由提供唐克里斯蒂:Ubuntu 12.04 或 13.04 中未禁用自动挂载

更新

# more /etc/udev/rules.d/85-no-automount.rules
SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0"
  • 内核桌面开发-3.16.6-2.1.x86_64
  • udev-210-25.5.4.x86_64
  • udiks2-2.1.3-2.1.5.x86_64

答案1

您在 OpenSUSE 或 Fedora 等现代 Linux 发行版上看到的自动挂载是由优盘2服务。

因此,您可以通过停止该服务来在系统级别禁用该功能,例如:

# systemctl stop udisks2.service

要验证它是否已停止:

# systemctl status udisks2

当然,这种变化并不是永久性的。

默认情况下,udisks2 服务甚至未启用,因此在引导期间不会自动启动。相反,它是通过 Dbus 激活的(例如,当第一个用户启动桌面会话时)。

因此,如果你真的讨厌 udisks2:

$ systemctl mask udisks2

这将阻止所有启动,包括手动启动。

动机

为什么要通过 Fine disks2 磁盘管理器禁用自动挂载?

有几个很好的理由,例如

  • 解决 udisks2 自动挂载错误1
  • 对某些 USB 驱动器进行取证工作
  • 从 USB 设备上损坏的 FS 中拯救数据(自动挂载会导致更多破坏)

1.例如,在 Fedora 25 上,当连接 2 个作为 Btrfs RAID-1 镜像的 USB 设备时,镜像会自动挂载- 但在解锁屏幕时/run/media/juser/mirror它也会第二次挂载...而第一次挂载仍然有效/run/media/juser/mirror1...

答案2

# /etc/udev/rules.d/99-noautomount.rules
ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{UDISKS_PRESENTATION_NOPOLICY}="1"
ENV{UDISKS_AUTOMOUNT_HINT}="never"
ENV{UDISKS_SYSTEM_INTERNAL}="1"
ENV{UDISKS_IGNORE}="1"
ENV{UDISKS_AUTO}="0"

编辑:

https://www.systutorials.com/docs/linux/man/7-udisks/

UDISKS_PRESENTATION_HIDE
  If set to 1 this is a hint to presentation level software that the device should not be shown to the user.

UDISKS_PRESENTATION_NOPOLICY
  If set to 1 this is a hint to presentation level software that the device should not be automounted or autoassembled (for e.g. components of a multi-disk device).

UDISKS_AUTOMOUNT_HINT
  A variable to influence whether a device should be automounted. Possible values include "always" (to hint that a device should always be automounted) and "never" (to hint that a device should never be automounted). Note that this is only a hint - the auto-mounter might not honor it.

UDISKS_SYSTEM_INTERNAL
  If set, this will override the usual bus type based detection of whether a device is considered "system internal". "0" means "removable" (i. e. eligible for automounting, and normal users can mount), any other value means "system internal" (i. e. no automounting, and only administrators can mount).

https://www.systutorials.com/docs/linux/man/8-udisks/

UDISKS_IGNORE
  If set, this overrides the value of the HintIgnore property.

UDISKS_AUTO
  If set, this overrides the value of the HintAuto property.

答案3

原因很简单。如果挂载 usb vfat,udisk2 上的权限是错误的。以及如何修改的文档是低级别的。

使用:Raspberry 3,VERSION =“9(拉伸)”

我尝试在 USB 闪存驱动器上使用小型 SVN 存储库。我总是遇到 apache (www-data) 无法访问存储库的问题。因为权限始终仅为用户 pi (pi:pi) 设置。我没有找到在哪里可以改变这个。

现在自动加载被禁用,我自己安装驱动器。然后权限就ok了。 (根:用户)

相关内容