gentoo普通用户 mount usb提示: Not authorized to perform operation;u盘可读写操作,移动硬盘只能读操作,不能写操作

问题:xfce4下,USB 硬盘能自动挂载并显示,但是普通用户操作时,提示:Not authorized to perform operation。

时间:20160928

os:gentoo + xfce4 + openrc

解决方法:

cd /usr/share/polkit-1/actions

nano *.udisks*.*

把相应权限都改成Yes即可.

  <action id="org.freedesktop.udisks2.filesystem-mount">
    <description>Mount a filesystem</description>
    <description xml:lang="zh_CN">挂载文件系统</description>
    <message>Authentication is required to mount the filesystem</message>
    <message xml:lang="zh_CN">挂载文件系统需要身份验证</message>
    <defaults>
      <allow_any>yes</allow_any> /*修改这里,原来是<allow_any>auth_admin</allow_any>*/
      <allow_inactive>yes</allow_inactive>/*修改这里,原来是<allow_inactive>auth_admin</allow_inactive>*/
      <allow_active>yes</allow_active>
    </defaults>
  </action>

@20180725-1 上述操作,其实可以通过对rules的修改来实现,这样的话,更安全。对Policykit来说,rule可以实现对action的重新定义。可以参考这个链接

https://wiki.gentoo.org/wiki/Polkit#Rules 这部分内容“

 

Rules

 

Rules redefine who's authorized for an action. The rules files begin with a number and are processed in lexical order. The first file with a matching rule is used. Own files should have a low number, like 10. The filenames have the .rules suffix.

 

For example, to let the users of the wheel group also perform functions as administrators, create the following file:

 

FILE /etc/polkit-1/rules.d/10-admin.rules

 

polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});

 

To allow user larry to mount disks, create the following file:

 

FILE /etc/polkit-1/rules.d/10-udisks.rules

 

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.udisks2.filesystem-mount" &&
        subject.user == "larry") {
        return polkit.Result.YES;
    }
});

 

See man polkit for more information.”

 

@20180725-2 gentoo+plasma U盘可读写,而移动硬盘只能读操作,不能写操作(root也不行)。

#mount

.....

/dev/sdc1 on /run/media/sirius/backup type ntfs....TYPE是NTFS

 这个主要是mount ntfs出现的错误

#emerge -s ntfs3g 这个文件竟然不知道什么时间卸载了,注意看一下这个文件的说明“read-write"

#emerge ntfs3g 得到警告:CONFIG-FUSE-FS没有发现,修改# nano /usr/src/linux/.config  ,CONFIG_FUSE_FS=Y,

# cd /usr/src/linux ,

#make && make modules_install && make install ,

# genkernel --install initrafms。修改一下启动设置(略)

#nano /etc/fstab 

把 对应的ntfs 类型,改为 ntfs-3g(我发现不改也没关系,只要安装了NTFS3G)

 

#mount

 

.....

 

/dev/sdc1 on /run/media/sirius/backup type fuseblk....TYPE是fuseblk

 

posted @ 2016-09-28 08:49  RenBwo  阅读(2551)  评论(0编辑  收藏  举报