You are here: >

Linux and Unix vipw and vigr command

vipw commandAbout vipw and vigr
vipw and vigr syntax
vipw and vigr examples
Related commands
Linux and Unix main page

About vipw and vigr

The vipw and vigr commands are used to edit the password, group, shadow-password, and shadow-group files.

Description

The vipw and vigr commands edit the files /etc/passwd and /etc/group, respectively. If the -s flag is specified, these commands will edit the shadow (secure) versions of their 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.

vipw and vigr syntax

vipw [options]
vigr [options]

Options

-g, --group Edit group database.
-h, --help Display help message and exit.
-p, --passwd Edit passwd database.
-q, --quiet Operate quietly.
-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

The following environment variables affect the operation of the vipw and vigr commands:

VISUAL The editor to use.
EDITOR The editor to use 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.

vipw and vigr examples

vipw

Edit /etc/passwd.

vigr

Edit /etc/group.

vipw -s

Edit /etc/shadow.

vigr -s

Edit /etc/gshadow.

addgroup — Add a group to the system.
adduser — Add a group to the system.
groupadd — Add a group to the system.
useradd — Add a user to the system.
passwd — Change a user's password.
vi — Text editor based on the visual mode of ex.
visudo — Safely edit the sudoers file.