以下方法在 Production 環境有資安的風險。
Open a Terminal window. Type in sudo visudo
Add the following line to the END of the file (if not at the end it can be nullified by later entries):
開啟終端機畫面,直接輸入 sudo visudo
至檔案最尾端,編輯加入以下:
indy ALL=NOPASSWD: ALL
存檔完,還要關閉 Terminal window 生效。
重新登入後, 輸入 sudo bash ,就能讓 user 不用知道 root 密碼的情境下轉為 root 身份了。
另外、以下方式是避免每次 sudo 都要打密碼的麻煩:
約第 26 行 找到以下
%sudo ALL=(ALL:ALL) ALL
改成
%sudo ALL=(ALL:ALL) NOPASSWD:ALL