1、添加使用者,首先用adduser指令添加一個普通/系統使用者,指令如下:
# adduser [-r] –d /tommy tommy
//添加一個名為tommy的使用者
# passwd tommy //修改密碼
Changing password for user tommy.
New UNIX password: //在這裡輸入新密碼
Retype new UNIX password: //再次輸入新密碼
passwd: all authentication tokens updated successfully.
2、賦予root權限(推薦此法)
修改 /etc/sudoers 檔案,找到下面一行,在root下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
tommy ALL=(ALL) NOPASSWD:ALL
修改完畢,現在可以用tommy帳号登入,然後用指令sudo -i,即可獲得root權限進行操作。
本文轉自 zhuhc1988 51CTO部落格,原文連結:http://blog.51cto.com/changeflyhigh/1953691,如需轉載請自行聯系原作者