The Right Way To Edit /etc/passwd and /etc/group files in Linux using vipw and vigr commands

The vipw and vigr commands are used to safely edit the files /etc/passwd and /etc/group in Linux systems. They will put appropriate locks when editing /etc/passwd and /etc/group files to prevent other users from making any changes in them and avoid file corruption. When you run those commands with -s flag, they will edit the shadow versions of those files, i.e. /etc/shadow and /etc/gshadow, respectively.