插入 USB 硬體後如何要求密碼?

插入 USB 硬體後如何要求密碼?

目前我使用 Xubuntu 11.10,我的問題是:插入 USB 硬體時如何請求密碼?

例子:

我插入 USB 大容量儲存:現在 xubuntu 打開一個視窗並顯示 USB 大容量儲存的檔案和資料夾。我希望當我插入 USB 大容量儲存(或任何其他 USB 硬體)時詢問“root/sudo”密碼,並在顯示文件和資料夾或進行其他操作後。

答案1

對於 Ubuntu 11.10

  1. 使用以下命令建立 .pkla 檔案。

    gksu gedit /var/lib/polkit-1/localauthority/50-local.d/mount-usb.pkla
    
  2. 將以下文字貼到文件內容中,然後儲存文件。

    [Mounting, checking, etc. of external drives]
    Identity=unix-group:admin
    Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.filesystem-check;org.freedesktop.udisks.filesystem-unmount-others;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks.change;org.freedesktop.udisks.luks-unlock
    ResultActive=auth_admin_keep
    
  3. 登出,然後重新登入。

來源(Ubuntu 論壇)我已經用兩個 USB 驅動器(一個是閃存驅動器,另一個是外部硬碟)對其進行了測試,一切似乎都運行完美!

相關內容