vipw和vigr命令
Modifying the Configuration Files
To add user accounts, it suffices that one line is added to /etc/passwd and another line is added to /etc/shadow, in which the user account and all of its properties are defined. It is not recommended, though. By making an error, you might mess up the consistency of the file and make logging in completely impossible to anyone. Also, you might encounter locking problems if one administrator is trying to modify the file contents directly while another administrator wants to write a modification with some tool.
If you insist on modifying the configuration files directly, you should use vipw . This command opens an editor interface on your configuration files, and more important, it sets the appropriate locks on the configuration files to prevent corruption. It does not check syntax, however, so make sure that you know what you are doing because even by making a typo you might still severely mess up your server. If you want to use this tool to modify the /etc/shadow file, use vipw -s . To edit the contents of the /etc/group file where groups are defined, a similar command with the name vigr exists.
NOTE It is nice to know that vipw and vigr exist, but it is better not to use these utilities or anything else that opens the user and group configuration files directly. Instead, use tools like useradd and groupmod.
这两个命令最主要就是会给文件加锁!以免在编辑文件时!其他用户也在同时使用文件!而造成其他用户修改的不成功!
vipw 修改/etc/passwd文件
vipw –s 修改/etc/shadow文件
vigr 修改/etc/groups文件
vigr –s 修改/etc/gshadow文件
[root@rhel7 ~]# man vipw
VIPW() System Management Commands VIPW() NAME
vipw, vigr - edit the password, group, shadow-password or shadow-group file SYNOPSIS
vipw [options] vigr [options] DESCRIPTION
The vipw and vigr commands edits the files /etc/passwd and /etc/group, respectively. With the -s flag, they will edit the shadow versions of those files,
/etc/shadow and /etc/gshadow, respectively. The programs will set the appropriate locks to prevent file corruption. When looking for an editor, the
programs will first try the environment variable $VISUAL, then the environment variable $EDITOR, and finally the default editor, vi(). OPTIONS
The options which apply to the vipw and vigr commands are: -g, --group
Edit group database. -h, --help
Display help message and exit. -p, --passwd
Edit passwd database. -q, --quiet
Quiet mode. -R, --root CHROOT_DIR
Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. -s, --shadow
Edit shadow or gshadow database. ENVIRONMENT
VISUAL
Editor to be used. EDITOR
Editor to be used if VISUAL is not set. FILES
/etc/group
Group account information. /etc/gshadow
Secure group account information. /etc/passwd
User account information. /etc/shadow
Secure user account information. SEE ALSO
vi(), group(), gshadow() , passwd(), , shadow(). shadow-utils 4.1.5.1 // VIPW()
Manual page vipw() line / (END) (press h for help or q to quit)
vipw和vigr命令的更多相关文章
- 关于UID和GID的创建、修改、删除;简要举例
用户.组和权限 安全3A资源分派 (authentication)认证 (authorization)授权 (accounting)审计 user( 用户) Linux用户:Username/UID ...
- (转)linux服务器安全配置攻略
引言: 最小的权限+最少的服务=最大的安全 所以,无论是配置任何服务器,我们都必须把不用的服务关闭.把系统权限设置到最小话,这样才能保证服务器最大的安全.下面是CentOS服务器安全设置,供大家参考. ...
- 第2章 细说Linux系统用户/组管理(1)
2.1 用户和组的基本概念 用户和组是操作系统中一种身份认证资源. 每个用户都有用户名.用户的唯一编号uid(user id).所属组及其默认的shell,可能还有密码.家目录.附属组.注释信息等. ...
- linux服务器基本安全配置手册
转:忘了在哪转的,直接复制到笔记里了,贴出来分享 假如你想要搭建一个Linux服务器,并且希望可以长期维护的话,就需要考虑安全性能与速度等众多因素.一份正确的linux基本安全配置手册就显得格外重要. ...
- 第五天、vim,重定向,用户和组管理
第五天.vim,重定向,用户和组管理 vim vi:Visual editor,文本编辑器 行编辑器:sed 全屏编辑器:vim,vi,nano 其他编辑器gedit,gvim 定义别名让vi等于vi ...
- 用户和组的权限管理/特殊权限和ACL(个人笔记)
个人学习笔记总结 内容包括解释Linux的安全模型解释用户帐号和组群帐号的目的用户和组管理命令理解并设置文件权限默认权限特殊权限ACL介绍安全3A资源分派:Authentication:认证Auth ...
- linux服务器安全配置攻略
引言: 最小的权限+最少的服务=最大的安全 所以,无论是配置任何服务器,我们都必须把不用的服务关闭.把系统权限设置到最小话,这样才能保证服务器最大的安全.下面是CentOS服务器安全设置,供大家参考. ...
- Linux用户和组的配置文件
用户和组的主要配置文件 前两个是放用户账号相关的,后两个是放和组相关的 /etc/passwd:用户及其属性信息(名称.UID.主组ID等) #早期密码也放这里,后来发现不安全,谁都能看 /etc/s ...
- Debian11管理员手册
1 用户与群组数据库 用户清单通常保存在 /etc/passwd 文件内,把哈希编码后的密码保存在 /etc/shadow 文件内.这两个文件都是纯文本档,以简单的格式保存,可以用文本编辑器读取与修改 ...
随机推荐
- 34.Spring-Aop.md
http://blog.csdn.net/bigtree_3721/article/details/50759843 目录 [toc] --- 1.概念 1.1概念 AOP是Spring提供的关键特性 ...
- [Git]更新远程代码到本地仓库
1. 查看远程仓库 $ git remote -v 2.从远程获取最新代码到本地 $ git fetch origin master 3.比较代码 $ git log -p master.. orig ...
- js 鼠标双击滚动单击停止
<!DOCTYPE html> <html> <head> <title>双击滚动代码</title> <script src=&qu ...
- Day1 初识Python
(1)变量与赋值 name = "wanghuafeng" age = 29 print(name, age) a和b交换值 a = 3 b = 5 tmp = a a = b b ...
- python函数参数的pack与unpack
python函数参数的pack与unpack 上周在使用django做开发的时候用到了mixin(关于mixin我还要写一个博客专门讨论一下,现在请参见这里),其中又涉及到了一个关于函数参数打包(pa ...
- vector list array deque
因此在实际使用时,如何选择这三个容器中哪一个,应根据你的需要而定,一般应遵循下面 的原则: 1.如果你需要高效的随即存取,而不在乎插入和删除的效率,使用vector 2.如果你需要大量的插入和 ...
- Web Services 介绍
Web Services 介绍 Web Services 是建立可交互操作的分布式应用程序的新平台 ; Web Services 平台是一套标准,它定义了应用程序如何在 Web 上进行交互操作 , 你 ...
- chrome代理服务器设置
在百度的内网很难访问chrome的相关站点,如果安装一些chrome的插件很不方便,所以呢,研究了一下chrome浏览器的代理模式,FQ安装插件. Chrome设置代理服务器的方法大体有几种: 1. ...
- IOS笔记 1
< ![CDATA[ 笔记 UIWindows 与UIView的关系iOS的坐标系统视图层次结构视图坐标(Frame和Bounds区别)UIView的常用属性和方法坐标系统的变换UIView内容 ...
- javascript note
boolean("false") =====>true Date(1387123200000)不等于new Date(1387123200000) 用Date(1387123 ...