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 文件内.这两个文件都是纯文本档,以简单的格式保存,可以用文本编辑器读取与修改 ...
 
随机推荐
- 一个小玩具:NDK编译FFmpeg的例子
			
FFmpeg NDK编译 和最简单的APK 准备 硬件: 一台电脑,实验在Lenovo T430上 一个Android设备,实验在 三星S3/A7 编译环境: Ubuntu 14.04 (ant\ja ...
 - 如何用angularjs制作一个完整的表格之二__表格分页功能
			
接上一次,这次主要介绍表格分页功能,由于项目需要这个案例是关于前端分页的方式,现在很少会这么用了,但如有需要可以参考其中的思路 html: 1.通过UL来展示页标,其中每个页标的li是通过异步加载从获 ...
 - localstorage || globalStorage || userData
			
globalStorage 这个也是html5中提出来,在浏览器关闭以后,使用globalStorage存储的信息仍能够保留下来,并且存储容量比IE的userdata大得多,一个域下面是5120k.和 ...
 - set_time_limit() 控制页面运行时间
			
当你的页面有大量数据时,建议使用set_time_limit()来控制运行时间,默认是30s,所以需要你将执行时间加长点,如 set_time_limit(300) ,其中将秒数设为0 ,表示持续运 ...
 - 织梦DedeCms用SQL语句调用数据库任意内容
			
dedecms多站点数据利用SQL句段进行互相调用数据方法:2个或者多个DEDE的站怎么互相调用数据,非JS调用,前提是2个或者多个dedecms站点都安装的同一个数据库的不同数据表内,才能实现功能. ...
 - [Python笔记]第二篇:运算符、基本数据类型
			
本篇主要内容有:运算符 基本数据类型等 一.运算符 1.算术运算 2.比较运算 3.赋值运算 4.逻辑运算 5.成员运算 6.身份运算 7.位运算 8.运算符优先级 二.基本数据类型 1.整数:int ...
 - NOIP[2015] 运输计划
			
传送门 题目描述 Description 公元 2044 年,人类进入了宇宙纪元.L 国有 n 个星球,还有 n−1 条双向航道,每条航道建立在两个星球之间,这 n−1 条航道连通了 L 国的所有星球 ...
 - JS学习之页面加载
			
1.window.opener.location.reload(); 意思是让打开的父窗口刷新.window.opener指的是本窗口的父窗口,window.opener.location.h ...
 - CentOS 6用snmp配合MRTG显示系统状态
			
1. 软件安装以yum的方式安装snmp/MRTG 安装SNMP(要记得安装net-snmp-utils,不然snmpwalk将不能使用)yum -y install net-snmp* 安装MRTG ...
 - GIS
			
def GIS(): global C global FeaWeights for wid in WordDic.keys(): FeaWeights[wid] = {} for classid in ...