當你在圖形界面裡點擊硬盤的盤符,希望掛載一個分區的時候,可能會遇到
‘Not authorized to perform operation.’ 的問題,權限不夠,無法mount該分區。解決方法是下面幾步
創建文件/etc/polkit-1/localauthority/50-local.d/10-storage-group-mount-override.pkla寫入內容
[storage group mount override] Identity=unix-group:storage Action=org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.filesystem-mount-system ResultAny=yes ResultInactive=yes ResultActive=yes
檢查文件/usr/share/polkit-1/actions/org.freedesktop.udisks2.policy, 確保你擁有:
Mount a filesystem Authentication is required to mount the filesystem auth_admin auth_admin yes
其中最關鍵的是這行
yes
窗口管理器用polkit來管理權限,當你請求掛載分區的時候,polkit會搜索step 2中的配置文件,根據Action參數來查找應該采用什麼樣的動作,然後在step 3的配置文件中找到改動作和對應的權限配置,如果權限無誤則執行改動作.