Loading

vipw 命令

作用:使用vipw命令可以直接编辑/etc/passwd文件

描述
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(1).

用法:vipw [选项]

选项:

-g, --group                   编辑 group 数据库
-h, --help                    显示此帮助信息并推出
-p, --passwd                  编辑 passwd 数据库
-q, --quiet                   安静模式
-R, --root CHROOT_DIR         chroot 到的目录
-s, --shadow                  编辑 shadow 或 gshadow 数据库

说明

vipw 命令允许 root 账户编辑系统的密码文件/etc/passwd。默认的编辑器是 vi ,在对 /etc/passswd 文件进行编辑时先锁定文件,编辑完成后再解锁,这样可以保证文件的一直性。vipw 命令的功能等同于 " vi /etc/passwd" 命令,但 vipw 命令的安全性更高。但我测试使用 vipw 命令修改 /etc/passwd 发现其并不能检查该文件各字段是否正确,所以还是有一定的风险。***

posted @ 2021-04-20 00:44  五月的麦田  阅读(771)  评论(0编辑  收藏  举报