Appearance
Linux 添加管理员账号
新建用户,以
username为例:Bash$ useradd username设置密码:
Bash$ passwd username赋予管理员权限(实际上等价于修改
/etc/sudoers文件):Bash$ sudo visudo找到
root ALL=(ALL) ALL, 在后面添加username ALL=(ALL) ALL,如下所示:INI... ## Next comes the main part: which users can run what software on ## which machines (the sudoers file can be shared between multiple ## systems). ## Syntax: ## ## user MACHINE=COMMANDS ## ## The COMMANDS section may have other options added to it. ## ## Allow root to run any commands anywhere root ALL=(ALL) ALL username ALL=(ALL) ALL ...Note:如想让新用户使用
sudo命令时不用输密码,把最后一个ALL改为NOPASSWD:ALL即可。