解决无法自动挂载U盘问题

本文参考网络资料写成。感谢google.感谢在linux及相关开发者,感谢linux爱好者为解决各种问而付出的努力.站在巨人的肩膀上,才能看的更远.
prife 首发于csdn.08年/9月.
欢迎转载.请著明出处

系统: fedora9
安装方式:自定义安装。只安装文本界面(或者称为字符截面),后  yum 升级 XFCE4.4 桌面环境。
症状:普通用户登陆X windows后,无法自动挂载U盘,光盘。以及其他可移动设备。

自从 命令行安装了裁减安装了fedora9之后.就无法自动挂载可移动容器.也无法自动挂载windows分区.
这是十分不方便的.每次读写可移动容器.都搞的很郁闷.因为必须载终端下 cp .move .rm.很不爽.
我终于被这种方式搞崩溃了.所以决定解决这个问题.
首先看到此文
http://www.sudu.cn/info/html/edu/linux/20070101/291856.html内容如下
=========================================================
    从命令行安装后,u盘的自动挂载方法
   
安装udev,hotplug,hal,dbus,gnome-mount,gnome-volume-manager
启动hotplug,hal 和 dbus 服务,并将这些服务加入到开机自启动列表
添加”gnome-volume-manager
–sm-disable”这一行到System->preferences->Sessions->Startup
programs,并重新登录gnome,这样能够确保gnome-volume-manager随gnome启动
删除或注释掉/etc/fstab中有关可移动设备挂载的部分,因为hald的script会检查/etc/fstab中的内容,假如已挂载或存在相关选项,就忽略该设备。
将想要使用自动挂载的用户加入plugdev组,”gpasswd -a someuser plugdev”,因为非plugdev组的普通用户不能使用自动挂载功能。
===========================================================
使用
  1. sudo rpm -qa | grep 软件名
得知udev hal dbus gnome-mount gnome-volume-manager都已经安装了
只有hotplug没有安装.
但是 sudo yum install hotplug 发现源中并无此软件包.

从redhat官方网站帮助网
=============================================================
7.6. Kernel device, module loading, and hotplug changes

The hotplug and device handling subsystem has undergone significant changes in Fedora Core. The udev method now handles all module loading, both on system boot and for hotplugged devices. The hotplug package has been removed, as it is no longer needed.

Support for hotplug helpers via the /etc/hotplug, /etc/hotplug.d, and /etc/dev.d directories is deprecated, and may be removed in a future Fedora Core release. These helpers should be converted to udev rules. Please see http://www.reactivated.net/writing_udev_rules.html for examples.
=============================================================
文写于2006年.文中说hotplug报已经被移除了.并且不再需要.所以yum也就安装不了
而且我的/etc/group文件中并没有 plugdev组,也就无法执行
  1. su -c "gpasswd -a 用户名 plugdev"
于是再网上继续google.因为我想知道到底 这个组是由哪个程序创建的?
找到不少和我有同样问题的帖子.
如此帖.
ttp://bbs.archlinux.org/viewtopic.php?id=47174
我决定添加plugdev这个组,再把prife添加到这个组中.
  1. [root@localhost ~]# useradd -G plugdev root
  2. useradd: unknown group plugdev
  3. [root@localhost ~]# groupadd plugdev
  4. [root@localhost ~]# more /etc/group | grep "plugdev"
  5. plugdev:x:504:
  6. [root@localhost ~]# more /etc/group 
  7. root:x:0:root,prife
  8. bin:x:1:root,bin,daemon
  9. daemon:x:2:root,bin,daemon
  10. sys:x:3:root,bin,adm
  11. adm:x:4:root,adm,daemon
  12. tty:x:5:
  13. disk:x:6:root
  14. lp:x:7:daemon,lp
  15. mem:x:8:
  16. kmem:x:9:
  17. wheel:x:10:root,prife
  18. ......
  19. jackuser:x:488:
  20. plugdev:x:504:
  21. [root@localhost ~]# useradd -G plugdev root
  22. useradd: user root exists
  23.  usermod -a -G plugdev root
编辑/etc/group文件
  1. [root@localhost ~]# vim /etc/group
在最后一行中添加了   ,prife  
然后重启系统发现还是不行.
所有参考的网页如下:
==================================================
New days ,the Next Day
==================================================
/etc/PolicyKit/PolicyKit.conf    不知道此文件是作什么呢?
/etc/hal/fdi/policy/ 该目录下空空如也.所以我创建了一个配置文件
不过创建成功以后依然 无法挂载系统.
最后还是在此贴上解决问题...
http://foo-projects.org/pipermail/lunar/2008-August/008081.html
  1. Hello,

  2. if you use kde3 (or other DM) in Lunar and insert pendrive or any other hot 
  3. plugable device the kde will show you option to mount it. If an user will 
  4. agree to mount it the error will appear:
  5. "org.freedesktop.hal.storage.mount-removable no <-- (action, result)"

  6. There is easy fix for this error. Just define security rules 
  7. in /etc/PolicyKit/PolicyKit.conf like these:

  8. <config version="0.1">

  9. <match action="org.freedesktop.hal.storage.mount-removable">
  10.   <match user="Put user account name here">
  11.     <return result="yes"/>
  12.   </match>
  13. </match>

  14. <match action="org.freedesktop.hal.storage.mount-fixed">
  15.   <match user="Put user account name here">
  16.     <return result="yes"/>
  17.   </match>
  18. </match>

  19. </config>

  20. First rule allows automounting pendrives, the second one is for fixed disks 
  21. like hard drives.

  22. have a nice day,
  23. Zbigniew 'zbiggy' Luszpinski
参照此文做如下操作。
  1. cd /etc/PolicyKit
  2. sudo cp PolicyKit.conf  PolicyKit.conf.back
  3. sudo gedit PolicyKit.conf
将文件中内容全部删除。将下列文件复制到此文中。
  1. <config version="0.1">
  2. <match action="org.freedesktop.hal.storage.mount-removable">
  3.   <match user="Put user account name here">
  4.     <return result="yes"/>
  5.   </match>
  6. </match>
  7. <match action="org.freedesktop.hal.storage.mount-fixed">
  8.   <match user="Put user account name here">
  9.     <return result="yes"/>
  10.   </match>
  11. </match>
  12. </config>
请将橘黄色文字 Put user account name here 该为您的 用户名。比如我把它改为 prife
然后重起 HAL 服务
  1. sudo /etc/service haldaemon restart
通过修改这个配置文件修复了无法自动挂载u盘和光盘的问题.)
OK ,现在取得阶段性胜利...下一个问题,如何自动挂载 windows分区 ..并且使当前普通用户具有读写的权限..而且需要在桌面上有windows分区的图标.. .
=====================================================
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值