What is the difference between
adduser user_name group_name
and
usermod -G -a user_name group_name
At first glance they seems to do the same thing : add a user to a group.
What is the difference between
adduser user_name group_name
and
usermod -G -a user_name group_name
At first glance they seems to do the same thing : add a user to a group.
adduser
andusermod
are two different utilities which have in common the fact that both can add a user to a group.According to man adduser
More info:
At first glance, yes.
At second glance,
usermod -G -a user_name group_name
is not correct.The
-G
option should be followed by the group name(s).The
-a
can come before-G
, or after the group name(s), but not between-G
and the group name(s).As a side note,
adduser
itself usesgpasswd
: