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 文件内.这两个文件都是纯文本档,以简单的格式保存,可以用文本编辑器读取与修改 ...
随机推荐
- TCP/IP-入门
Life is not a rehearsal "人生没有彩排" 参考资料:TCP/IP入门经典 (第五版) TCP/IP详解 卷一:协议 一.什么是TCP/IP TCP/IP是一 ...
- Js仿弹框
收藏一个简单实用的JS弹框,通过隐藏和显示div来实现,代码来自脚本之家! <html> <head> <title> LIGHTBOX EXAMPLE </ ...
- MongoDB-GRIDFS大文件系统
gridfs 是一种在mongodb中存储大二进制文件的机制,使用gridfs的原因: 1.存储巨大的文件(视频图片). 2.利用GRIDFS可以简化需求. 3.GRIDFS 利用已经建立起来的复制以 ...
- js 数字添加逗号,格式化数字
function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + ...
- PF_NETLINK应用实例NETLINK_KOBJECT_UEVENT具体实现--udev实现原理
PF_NETLINK应用实例NETLINK_KOBJECT_UEVENT具体实现--udev实现原理 相对于linux来说,udev还是一个新事物.然而,尽管它03年才出现,尽管它很低调(J),但它无 ...
- 打patch p0 p1区别
如何使用patch 对于一个patch文件,有两种常用使用方法: 1.代码:cat new-patch | patch -p0 2.代码:patch -p0 < new-patch patc ...
- 主席树套树状数组 动态区间第k小
先打上代码以后更新解释 #include <cstdio> #include <iostream> #include <algorithm> #include &l ...
- 【转】(DT系列六)devicetree中数据和 struct device有什么关系
原文网址:http://www.cnblogs.com/biglucky/p/4057499.html devicetree中数据和structdevice有什么关系 总体来说,devicetree与 ...
- sql server 的ANSI_NULLS设置
当 SET ANSI_NULLS 为 ON 时,表示SQL语句遵循SQL-92标准.当 SET ANSI_NULLS 为 OFF 时,表示不遵从 SQL-92 标准. SQL-92 标准要求对空值(N ...
- PCRE
http://blog.sina.com.cn/s/blog_6a1837e901010ckv.html http://hubeihuyanwei.blog.163.com/blog/static/2 ...