本地磁盤分區無權限掛載的問題


轉自 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

就要按上面文章中的方法來解決.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM