Ubuntu 使用者不在sudoers檔案中

來源:互聯網
上載者:User

標籤:ubuntu   sudo   

    某次重啟系統,使用sudo命令時突然出現問題,使用者不在sudoers檔案中,無法使用sudo許可權。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/45/41/wKiom1Plb5LSdAn-AAGJp2UUTKw953.jpg" title="2014-08-09 08:44:03 的螢幕.png" alt="wKiom1Plb5LSdAn-AAGJp2UUTKw953.jpg" />

    重啟進入復原模式,依然無法修改sudoers檔案,可以設定root($su root)密碼,但是正常進入系統之後依然無效。(此時系統處於 read-only 模式),因此需要進入讀寫入模式設定:

    1. 重啟進入復原模式;

    2.選擇 fsck 進入可讀寫檔案模式(exit read-only mode)

    3.選擇 root Drop to root shell prompt

    4.$usermode -a -G sudo nick    (此次不存在admin組,因此使用sudo使用者組)

重新啟動,可以使用sudo。

嘗試修改root密碼

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/45/42/wKiom1Pld6-Q-ptpAADmF8VL-6M074.jpg" title="2014-08-09 09:20:50 的螢幕.png" alt="wKiom1Pld6-Q-ptpAADmF8VL-6M074.jpg" />

如果擁有其他管理員帳號,那麼修改/etc/sudoer 檔案,在其中添加

username ALL=(ALL) ALL

應該也是有效。

參考文檔:

【Linux】使用者不在sudoers檔案中

【Linux】ubuntu預設的root密碼

Fixing “username is not in the sudoers file. This incident will be reported” Error In Ubuntu

本文出自 “颯颯秋風” 部落格,請務必保留此出處http://xjhznick.blog.51cto.com/3608584/1537804

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.