centos6.5 新建了一个用户,希望给他root权限,网上说,编辑/etc/sudoers中的
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
在后面添加
tommy ALL=(ALL) ALL就好了。
但是我找不到这段话,这段话在哪里?
这是我的sudoers
[root@localhost ~]# vi /etc/sudoers
## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
##
## This file must be edited with the 'visudo' command.
## Host Aliases
## Groups of machines. You may prefer to use hostnames (perhaps using
## wildcards for entire domains) or IP addresses instead.
# Host_Alias FILESERVERS = fs1, fs2
# Host_Alias MAILSERVERS = smtp, smtp2
## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than USERALIAS
# User_Alias ADMINS = jsmith, mikem
## Command Aliases
"/etc/sudoers" [readonly] 111L, 3729C
经过观察,你这个朴素的做法有个最大的问题:你用 vim 打开文件后,没有翻页。
另外,你目前是只读状态,是无法修改该文件的。两罪并罚,请使用
visudo
。