通常我们不会以 root 用户来使用系统,本文将介绍如何创建一个非特权的用户。
1$ sudo useradd -G wheel -m foobar
foobar
为用户名,请自行修改。-G
指定用户组,wheel
是一个特殊的用户组,用于获取管理员权限(sudo),后续步骤会进行说明。1$ sudo passwd foobar
1$ sudo visudo
1## Uncomment to allow members of group wheel to execute any command
2#%wheel ALL=(ALL:ALL) ALL
去掉 %wheel ALL=(ALL:ALL) ALL
前面的 #
以取消注释,让 wheel
用户组获得管理员权限。