Linux 基础命令 -- visudo

命令介绍

命令:visudo 编辑/etc/sudoers文件的专属命令

用法:visudo [-chqsV] [-f sudoers]

命令选项

[root@fp-21 ~]# visudo --help

Options:
  -c, --check              # 仅检查模式
  -f, --file=sudoers       # 指定sudoers文件位置
  -h, --help               # 帮助文档
  -q, --quiet              # 启用安静模式,此模式下不显示错误信息
  -s, --strict             # 启用严格检查sudoers文件
  -V, --version            # 版本信息

命令实例

# 编辑/etc/sudoers文件的专属命令
[root@fp-21 ~]# visudo
## 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.
……

# 仅检查模式
[root@fp-21 ~]# visudo -c
/etc/sudoers: parsed OK

# 启用安静模式,此模式下不显示错误信息
[root@fp-21 ~]# visudo -q

## 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.
……

[root@fp-21 ~]# visudo -s
……
visudo: /etc/sudoers.tmp unchanged

link 查看 Linux 基础命令

只有注入思想的博客才是好的博客

发布了24 篇原创文章 · 获赞 69 · 访问量 3207

猜你喜欢

转载自blog.csdn.net/xtlhxl/article/details/104346850