sudo不能使用解決

來源:互聯網
上載者:User

sudo不能使用解決 今天裝完系統發現我的sudo命令不能正常使用,大致情況如下:.......We trust you have received the usual lecture from the local System  Administrator. It usually boils down to these three things:       #1) Respect the privacy of others.      #2) Think before you type.      #3) With great power comes great responsibility. ......  後來在網上尋找了相關資料,具體解決方案如下:1、用su - 登入root模式2、改變檔案sudoers的許可權為可寫:chmod 740 /etc/sudoers3、用vi開啟sudoers檔案:vi /etc/sudoers4、在root ALL=(ALL) ALL處斷行符號,另起一行寫上:username ALL=(ALL) ALL5、儲存退出6、把sudoers的許可權改為預設的440:chmod 440 /etc/sudoers7、退出root到普通使用者模式,使用sudo測試,通過!註:如果想要在使用sudo時不輸入密碼,可以把4處改為:username ALL=NOPASSWD:ALL 完整範例:# /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. #  Defaults    env_reset  # Host alias specification  # User alias specification  # Cmnd alias specification  # User privilege specification root    ALL=(ALL) ALL #tiger   ALL=(ALL) ALL tiger   ALL=NOPASSWD:ALL  # Uncomment to allow members of group sudo to not need a password # (Note that later entries override this, so you might need to move # it further down) # %sudo ALL=NOPASSWD: ALL  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.