首先root 权限创建新用户及密码:
sudo -i
$ sudo adduser yzpeng
root 18:42:52 ~
$ sudo passwd yzpeng
Changing password for user yzpeng.
New password:
BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
接着进入新用户,并添加PS1 值:
su -l yzpeng
$ cat >> ~/.bashrc
PS1="\[\033]2;\h:\u \w\007\033[33;1m\]\u \033[35;1m\t\033[0m \[\033[36;1m\]\w\[\033[0m\]\n\[\e[32;1m\]$ \[\e[0m\]"
检查一下文件/etc/sudoers,确保下面这行没有被注释:
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
接着在root 用户下,将新用户添加到root 组并查看:
$ groups yzpeng
yzpeng : yzpeng
yzpeng 18:47:35 ~
$ groups root
root : root
usermod -g root yzpeng
$ groups yzpeng
yzpeng : root
就可以快乐使用了!