Chinaunix首页 | 论坛 | 博客
  • 博客访问: 618337
  • 博文数量: 140
  • 博客积分: 2635
  • 博客等级: 少校
  • 技术积分: 1353
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-04 15:46
文章分类
文章存档

2015年(2)

2014年(12)

2013年(10)

2012年(10)

2011年(85)

2010年(21)

分类: LINUX

2011-05-27 15:02:23

10.04挂载硬盘时好像已经不再输入密码了,这样安全性不够高哦,如果想要在Ubuntu挂载硬盘需要输入密码的话。怎么办呢?

打开终端:

sudo gedit /var/lib/polkit-1/localauthority/10-vendor.d/com..desktop.pkla

启用Ubuntu挂载硬盘需要输入密码方法

里面会有

[Mounting, checking, etc. of internal drives]
Identity=unix-group:admin
Action=org.freedesktop.udisks.filesystem-*;org.freedesktop.udisks.drive-ata-smart*
ResultActive=yes

[Change CPU Frequency scaling]
Identity=unix-group:admin
Action=org.gnome.cpufreqselector
ResultActive=yes

[Setting the clock]
Identity=unix-group:admin
Action=org.gnome.clockapplet.mechanism.*
ResultActive=yes



fedora12中已经使用polkit-1(实际版本号是0.95),提供系统范围的授权机制。
参见
这个新东西目前没有图形界面下的配置方法,使用不是很方便~
下面以本人经历---给普通用户无需root密码挂载本地磁盘的权限为例说明:
可以通过命令

CODE:
pkaction --action-id org.freedesktop.devicekit.disks.filesystem-mount-system-internal --verbose

你可能会问org.freedesktop.devicekit.disks.filesystem-mount-system-internal这个名字
(配置里称为action-id)是怎么事先知道的。看下图
默认情况下,要挂载
本地的磁盘分区,会弹出如图的对话框,提示输入root密码。点开“详细”,
下面的“动作”一项就给出了这一动作的名字(action-id)。
下面是默认情况下该命令的输出:
CODE:
pkaction --action-id org.freedesktop.devicekit.disks.filesystem-mount-system-internal --verbose
org.freedesktop.devicekit.disks.filesystem-mount-system-internal:
description: Mount a system-internal device
message: Authentication is required to mount the device
vendor: The DeviceKit Project
vendor_url:
icon: drive-removable-media
implicit any: no
implicit inactive: no
implicit active: auth_admin_keep

可以看到最后一行,意思是在活跃的会话中,需要验证为管理员,并且
保持这个获得的权限,(直到点击通知区域里的那个钥匙,放弃授权)。
要让普通用户不必输入密码,直接可以挂载磁盘分区,需要将
auth_admin_keep用yes替换。
默认的polkit权限设置在/usr/share/polkit-1/actions/目录下,
挂载本地磁盘的配置在org.freedesktop.devicekit.disks.policy这个文件中

和下面的之间。
首先取得root权限,然后编辑org.freedesktop.devicekit.disks.policy
这个文件中相应的那一行。(事先备份一下原来的配置文件是好习惯)
下面是我使用vim修改的截图(这是xml文档,我把原来的那行配置注释掉了)

之后保存,再挂载磁盘,就不会有那个提示框了,而是直接挂载上了。
参考:man polkit等

阅读(7711) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~