1、出現問題的緣由vim
今天安裝了centos6.5的系統,是裝的圖形界面。可是又不想重裝成mini版。全部就準備修改系統問題,讓系統開機自動進入命令模式。centos
2、錯誤提示ide
登陸的是普通用戶,修改/etc/inittab 文件spa
最後一行默認是:3d
id:5:initdefault: #默認進入圖像界面blog
只要將5修改爲3便可開機自動進入密令行模式。ci
可是修改保存時收到提示:get
xxx is not in the sudoers file. This incident will be reported。it
3、解決辦法登錄
修改/etc/sudoers文件。普通用戶是沒法修改這個文件的,需切換成root用戶。
一、/etc/sudoers 文件是隻讀文件,需先修改文件權限屬性
chmod u+w /etc/sudoers
二、vim /etc/sudoers,找到以下信息:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
在root下添加一行,其中leo爲你的用戶名。修改完wq保存退出。
leo ALL=(ALL) ALL
三、修改完後取消寫權限
chmod u-w /etc/sudoers
四:修改完後你用su - 便可得到root權限(su 用戶名 #切換用戶)