配置使用者的 sudo 存取權

使用此資訊,為可以執行 Cloud Application Business Insights 安裝的使用者配置 sudo 存取權。

開始之前

必要的話,建立使用者,然後設定密碼以指派 root 專用權。 以 root 使用者身分執行指令。
useradd <username>

程序

  1. 若要在 RHEL 上為使用者名稱啟用 sudo,請將使用者名稱新增至 wheel 群組。 以 root 使用者身分執行指令。
    usermod -aG wheel <username>
  2. 以超級使用者或管理者身分,執行 visudo 以編輯 /etc/sudoers 檔。 確保未註解行。
    visudo
    它會在文字編輯器中開啟 /etc/sudoers 檔。
    ## Allow root to run any commands anywhere
    root        ALL=(ALL)       ALL
    root ALL=(ALL) NOPASSWD:EXEC:ALL
    
    ## Allows members of the 'sys' group to run networking, software,
    ## service management apps and more.
    # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
    
    
    ## Allows people in group wheel to run all commands
    %wheel        ALL=(ALL)       ALL
    
    ## Allows people in group wheel to run all commands without password
    %wheel ALL=(ALL:ALL) NOPASSWD:ALL
    
  3. 儲存檔案並結束。
  4. 使用下列指令驗證 wheel 群組中是否提供新的使用者:
    grep 'wheel' /etc/group
    
    必須呈現下列輸出。
    wheel:x:10:<username>
  5. 透過使用下列指令,驗證新的使用者是否可以執行 Cloud Application Business Insights 的安裝作為 sudo
    1. 切換至新的使用者,以執行必要指令。
      su – <username>