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 文件内.这两个文件都是纯文本档,以简单的格式保存,可以用文本编辑器读取与修改 ...
随机推荐
- cas sso单点登录系列1_cas-client Filter源码解码(转)
转:http://blog.csdn.net/ae6623/article/details/8841801?utm_source=tuicool&utm_medium=referral /* ...
- jquery 工作空间注册
在一些面向对象的语言中有命名空间的概念,好处就是把不同的类放在不同的文件夹下面,这样就不会发生命名冲突,当然命名空间还有其他的作用. 在这里我们讨论的是在JS中怎么使用命名空间.当然JS并没有提供原生 ...
- 面向对象设计模式之Flyweight享元模式(结构型)
动机:采用纯粹对象方案的问题在于大量细粒度的对象会很快充斥在系统中,从而带来很高的运行代价——主要指内存需求方面的代价.如何在避免大量细粒度对象问题的同 时,让外部客户程序仍然能够透明地使用面向对象的 ...
- WebService cxf 接口中获得拦截器参数
1. 拦截器中put属性 Message message = PhaseInterceptorChain.getCurrentMessage(); message.put("AuthCode ...
- 直接插入排序(Straight Insertion Sort)的C语言实现
原创文章,转载请注明来自钢铁侠Mac博客http://www.cnblogs.com/gangtiexia 直接插入排序(Straight Insertion Sort)的基本思想是将新记录插入到 ...
- 黑马程序员—C语言的判断语句
------Java培训.Android培训.iOS培训..Net培训.期待与您交流! ------- 一.分支结构 结构化程序设计(英语:Structured programming),一种编程范型 ...
- UVa 10935 - Throwing cards away I (队列问题)
原题 Throwing cards away I Given is an ordered deck of n cards numbered 1 to n with card 1 at the to ...
- Struts2 DMI的使用
Struts2的Action类中可以放置多个方法并在struts.xml中配置供页面调用.只要方法符合execute()方法的标准即返回类型是String就可以了. 同一个Action多个方法调用的方 ...
- Mifare 0简介
Mifare UltraLight又称为MF0,从UltraLight(超轻的)这个名字就可以看出来,它是一个低成本.小容量的卡片.低成本,是指它是目前市场中价格最低的遵守ISO14443A协议的芯片 ...
- 符合altium designer操作习惯的cadence快捷键设置
本人开始学习画PCB的时候,用的都是protel,后来转投altium desinger,因为这两个软件上手快且大学里教的也就是这两种.但由于工作需要换成cadence,这就给我造成了很大的困扰,尤其 ...