centos6.5增加用戶,使其具有root權限
1.創建用戶
-bash-4.1# useradd fdp #創建用戶
-bash-4.1# passwd fdp #給指定用戶增加密碼
Changing password for user fdp.
New password: #錄入密碼,比如fdp123456
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password: #確認密碼,fdp123456,與上面的密碼一致
passwd: all authentication tokens updated successfully.
2.賦予文件修改權限
-bash-4.1# chmod u+w /etc/sudoers
-bash-4.1# ll /etc/sudoers
-rw-r-----. 1 root root 4002 Mar 2 2012 /etc/sudoers
3.追加用戶信息 #大概在/etc/sudoers配置文件的98行的位置
-bash-4.1# vi /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
fdp ALL=(ALL) ALL #追加的信息內容
%wheel ALL=(ALL) ALL #去掉前面默認註釋的井號
4.修改屬組關系
usermod -g root fdp
5.將用戶ID修改為與0(因為root用戶的ID也是0)
-bash-4.1# vi /etc/passwd
fdp:x:0:502::/home/fdp:/bin/bash #一般位於文件的最下方
6.關閉文件修改權限
-bash-4.1# chmod u-w /etc/sudoers
7.用新的戶名和密碼為fdp/fdp123456登錄即可。
centos6.5增加用戶,使其具有root權限