I find it much easier to edit files directly rather than remember commands like useradd -g, usermod, groupmod, etc. Is there anything wrong with just editing /etc/group directly?
2 Answers
Editing the group
, passwd
, and shadow
files directly is safe, but in order to do so you should use the vigr
and vipw
commands.
When using vigr
or vipw
, locks are applied to the files in order to prevent concurrent editing which can lead to file corruption.
-
1
-
-
2@ott--: Sometimes editing the
/etc/shadow
file directly is necessary or desirable. Some variants ofvipw
support a-s
option to do so. Just be careful and make sure you understand what you are doing. Read this or something similar.– user26112Jun 12, 2013 at 20:02
Apart from not making mistakes while doing so, you have to be aware that on systems where LDAP is setup useradd
etc. can also update the data there.
Essentially if only /etc/group
, and only a limited amount of lines in there, are effected you might as well edit the file.
If you have /etc
under revision control (mercurial
, git
) it is easy to roll-back changes.