Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
173 views
in Technique[技术] by (71.8m points)

如何修改sudoers?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

经过观察,你这个朴素的做法有个最大的问题:你用 vim 打开文件后,没有翻页。

另外,你目前是只读状态,是无法修改该文件的。两罪并罚,请使用 visudo


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...