zoukankan      html  css  js  c++  java
  • 本地磁盘分区无权限挂载的问题

    转自 http://blog.chinaunix.net/uid-25906175-id-3030600.html

    前段时间升级了 thunar 后,发现无法居然点击侧边栏的 windows 分区直 接挂载了,而是跳出个对话框显示『Authentication is required.』, 这个问题可不得了,不能访问 windows 分区显然是不行的。于是,又开始 了网上的艰苦游荡。终于,在这里找到了解决方法。这个其实不是 thunar 的问题,而是和 udisks 相关的。

    编辑文件 /usr/share/polkit-1/actions/org.freedesktop.udisks.policy 找到 <action id=”org.freedesktop.udisks.filesystem-mount-system-internal”> 标签,将里面的 auth_admin_keep 修改为 yes,然后保存即可,不需要注销或者重启。

    2012/03/04 更新:

    今天才发现,直接修改上述文件并不是很好的方法,因为每次 udisks 升级时会将其覆盖掉。 按照 Archlinux 的 wiki 所述,可以创建如下文件(需要 root 权限): /etc/polkit-1/localauthority/50-local.d/50-filesystem-mount-system-internal.pkla 其内容为:

    [Mount a system-internal device]
    Identity=*
    Action=org.freedesktop.udisks.filesystem-mount-system-internal
    ResultActive=yes
    

    这样也可以解决问题,而且升级时不会被覆盖掉。

    2012/04/28 更新:

    今天又出现了权限问题,点击侧边栏的 Windows 分区时,出现了『Not authorized to perform operation』的对话框。

    于是又在网上游荡起来,终于在这里发现端倪: 原来,昨天升级时安装了 udisks2,因而相应的分区挂载权限也由其接管。解决方法如下:

    修改上面创建的配置文件,将其中的 udisks 替换为 udisks2,即内容变为

    [Mount a system-internal device]
    Identity=*
    Action=org.freedesktop.udisks2.filesystem-mount-system
    ResultActive=yes
    

    修改后,发现果然又可以点击挂载了。

    2012/05/10 更新:

    今天打开 Thunar,发现居然又不可以点击挂载 Windows 分区了,再次出现 了上面的对话框,郁闷!于是又是一番艰辛搜索,终于在 Arch 的 wiki 上 看到了相关信息,见此:=Note: slim is also ConsoleKit capable since version 1.3.3. Unless you happen to run an old version, you must no longer include ck-launch-session from your .xinitrc or slim.conf logincmd.= 原来,slim 升级到 1.3.3 后,已经不需要在 .xinitrc 文件中添加 ck-launch-session了,直接将其去掉,如下:

    #!/bin/sh
    #
    # ~/.xinitrc
    #
    # Executed by startx (run your window manager from here)
    
    if [ -d /etc/X11/xinit/xinitrc.d ]; then
      for f in /etc/X11/xinit/xinitrc.d/*; do
        [ -x "$f"] && . "$f"done
      unset f
    fi
    
    exec dbus-launch /home/silver/.autostart.sh
    

    注销后重新登录,此时果然又可以直接点击挂载了。

    2012/11/01 更新:

    今天将系统迁移到了 systemd,发现 thunar 又不可以挂载内置分区了,点 击时提示『Not authorized to perform operation』。网上搜寻了好久, 将配置文件改了又改,可是始终不行。

    一度绝望之下,忽然想到是否可以直接修改 udisks2 的配置文件呢?编辑文件 /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy 找到 <action id="org.freedesktop.udisks2.filesystem-mount-system"> 修改其中的 <allow_active>auth_admin</allow_active> 为<allow_active>yes</allow_active> 再点击试了下,果然可以了!

     

    对原文进行一些补充:(2013-05-25)

    我搜到的比较完整的自建pkla文件的内容, 仅供参考. 不过对于使用systemd的系统, 可能没有用了.

    修改 etc/polkit-1/localauthority/50-local.d 新建文件,50-filesystem-mount-system-internal.pkla ,内容如下:

    [Override udisks2 filesystem-mount-system rule]
    Identity=unix-user:yourusername
    Action=org.freedesktop.udisks2.filesystem-mount-system
    ResultAny=auth_admin
    ResultInactive=auth_admin
    ResultActive=yes
    

    用 systemd 替换 udev 后, 如果想实现移动介质的自动挂载, 需要启动 # systemctl enable lvm-monitoring.service. 这样 u盘就不成问题了.

    但是对于别的硬盘分区, 虽然能在 文件管理器 中看到, 但点击挂载时, 却提示:

    Not authorized to perform operation
    

    就要按上面文章中的方法来解决.

  • 相关阅读:
    HTML5结构
    HTML5新增的非主体元素header元素、footer元素、hgroup元素、adress元素
    CF GYM 100703G Game of numbers
    CF GYM 100703I Endeavor for perfection
    CF GYM 100703K Word order
    CF GYM 100703L Many questions
    CF GYM 100703M It's complicate
    HDU 5313 Bipartite Graph
    CF 560e Gerald and Giant Chess
    POJ 2479 Maximum sum
  • 原文地址:https://www.cnblogs.com/jiqingwu/p/4043409.html
Copyright © 2011-2022 走看看