Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Linux 給一般使用者授予 sudo 權限:visudo 安全編輯 /etc/sudoers 四步驟

編輯:Linux 系統常見問題解答
  1. 切換 root:su -
  2. 授予寫入權:chmod u+w /etc/sudoers
  3. 編輯檔案:visudo (或 vim /etc/sudoers),在 root ALL=(ALL) ALL 下新增:
    username ALL=(ALL) ALL (username 為目標帳號)
  4. 移除寫入權:chmod u-w /etc/sudoers

最佳實務: 建議直接使用 visudo (內建語法檢查、鎖定防衝突),無需手動 chmod。若需免密碼 sudo,改為 username ALL=(ALL) NOPASSWD:ALL。授權後該使用者可執行 sudo 指令 取得 root 權限。

Copyright © Windows教程網 All Rights Reserved