编辑文件/etc/sudoers
用命令打开vi /etc/sudoers
打开之后,文件内容如下:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
%administrator ALL=(ALL) ALL
在文件末尾,添加新的用户:
例如:新用户名为aabb
%aabb ALL=(ALL)ALL