I'm doing a CentOS 8 automated install. I've previously had no problem creating a single user and adding it to a group like so:
user --name=othername --password=big_long_hash --iscrypted --groups=myname --homedir=/var/ftp --shell=/sbin/nologin
Despite documentation saying the group has to exist already, I've never had any issues.
Now I want to add multiple users to this group, so I add another line to my file
user --name=myname --groups=myname --homedir=/var/ftp --shell=/sbin/nologin
user --name=othername --password=big_long_hash --iscrypted --groups=myname --homedir=/var/ftp --shell=/sbin/nologin
And I get an error:
anaconda[1842]: program: Running... useradd -R /mnt/sysimage -U -G myname -d /var/ftp -m -s /sbin/nologin myname
useradd[25852]: failed adding user 'myname', exit code: 9
anaconda[1842]: program: useradd: group myname exists - if you want to add this user to that group, use -g.
anaconda[1842]: program: Return code: 9
anaconda[1842]: anaconda: kickstart.kickstart.user: User myname already exists
So I tried adding the line to create the group:
group --name=myname
user --name=myname --groups=myname --homedir=/var/ftp --shell=/sbin/nologin
user --name=othername --password=big_long_hash --iscrypted --groups=myname --homedir=/var/ftp --shell=/sbin/nologin
But no change. Tried not specifying the group:
group --name=myname
user --name=myname --homedir=/var/ftp --shell=/sbin/nologin
user --name=othername --password=big_long_hash --iscrypted --groups=myname --homedir=/var/ftp --shell=/sbin/nologin
This time the useradd
command doesn't have the group in it, but still fails with the same error. I think I'm just going to work around it by calling usermod
from the post-install script, but wanted to check if there's something I'm not understanding about adding groups and users in the Kickstart file.
I've never bothered with Kickstart's functionality for adding users or groups. I just do it myself in
%post
.