Linux command
vigr 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Edit the /etc/group file
sudo vigr
Edit the /etc/gshadow (shadow group) file
sudo vigr -s
Edit group files in a chroot environment
sudo vigr -R [/path/to/chroot]
说明
vigr edits the `/etc/group` file (or `/etc/gshadow` with -s) while setting appropriate locks to prevent file corruption from concurrent access. It first locks the file, creates a temporary copy, opens it in the user's preferred editor (checking `$VISUAL`, then `$EDITOR`, falling back to `vi`), performs syntax checks after editing, and then atomically replaces the original file.
参数
- -g, --group
- Edit the group database (default).
- -s, --shadow
- Edit the gshadow (shadow group) database.
- -p, --passwd
- Edit the passwd database (equivalent to running vipw).
- -q, --quiet
- Quiet mode.
- -R, --root _CHROOT_DIR_
- Apply changes in a chroot environment.
- -h, --help
- Display help message.
FAQ
What is the vigr command used for?
vigr edits the `/etc/group` file (or `/etc/gshadow` with -s) while setting appropriate locks to prevent file corruption from concurrent access. It first locks the file, creates a temporary copy, opens it in the user's preferred editor (checking `$VISUAL`, then `$EDITOR`, falling back to `vi`), performs syntax checks after editing, and then atomically replaces the original file.
How do I run a basic vigr example?
Run `sudo vigr` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -g, --group do in vigr?
Edit the group database (default).