The purpose of `/etc/group-`

directory-structureetcgroup

On a standard Linux distribution (e.g. Ubuntu) there is usually /etc/group and /etc/group-, where the second one is only readable by root.

man group only describes /etc/group.

Thus my question: What is the purpose of /etc/group-?

Best Answer

It is a backup of the previous copy of the file that is version of the file before the last change. It is kept because it is very important file. You can delete it, but backups are a "good thing".

You can easily verify it. Try

# groupadd test
# diff /etc/group /etc/group-

There are other files also that are backed up the same way viz. /etc/passwd- /etc/shadow-.

All the user and group management utilities like useradd, usermod, userdel, groupmod, groupdel etc. create/update these backup files after successful execution of the command.

Related Question