I'm trying to add a list of users to different groups on a debian VM. I am using the following sequence of commands in my bash script:
getent group $uid || groupadd $uid #add group before adding user
useradd -s $shell -m -d $users_directory -g $uid $uname #add user with group id $uid
However running this prints out the following:
groupadd: group '5067' already exists
useradd: group '5067' does not exist
looking at my groups with cut-d: -f1 /etc/group
I see that '5067' exists there, but when I run groups
all I see is 'root' as the lone group.
Any tips?
groupadd $uid
will create a group with gid$uid
and not a group with name$uid
.)