1、建使用者:
adduser phpq //建立phpq使用者
passwd phpq //給phpq使用者設定密碼
2、建工作組
groupadd test //建立test工作組
3、建立使用者同時增加工作組
useradd -g test phpq //建立phpq使用者并增加到test工作組
注::-g 所屬組 -d 家目錄 -s 所用的SHELL
4、給已有的使用者增加工作組
usermod -G groupname username
或者:gpasswd -a user group
[b]賦予root權限[/b]
方法一:修改 /etc/sudoers 檔案,找到下面一行,把前面的注釋(#)去掉
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
然後修改使用者,使其屬于root組(wheel),指令如下:
#usermod -g root tommy
修改完畢,現在可以用tommy帳号登入,然後用指令 su – ,即可獲得root權限進行操作。
方法二:修改 /etc/sudoers 檔案,找到下面一行,在root下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
tommy ALL=(ALL) ALL
修改完畢,現在可以用tommy帳号登入,然後用指令 sudo – ,即可獲得root權限進行操作。
方法三:修改 /etc/passwd 檔案,找到如下行,把使用者ID修改為 0 ,如下所示:
tommy:x:0:33:tommy:/data/webroot:/bin/bash