geerlingguy / packer-boxes

Jeff Geerling's Packer build configurations for Vagrant boxes.
https://app.vagrantup.com/geerlingguy
MIT License
651 stars 304 forks source link

missing equals sign in user directive of ks.cfg #55

Closed belfast77 closed 4 years ago

belfast77 commented 4 years ago

In the kickstart file you have a work around.

https://github.com/geerlingguy/packer-boxes/blob/master/centos8/http/ks.cfg

# Add vagrant user (user directive isn't working for some reason).
useradd vagrant
echo "vagrant" | passwd vagrant --stdin
usermod -a -G wheel vagrant

Your user directive is

#user --name=vagrant --plaintext --password vagrant --groups=wheel

I think you might be missing an equals sign, password seems to work for me in centos7 if I do this

--password=vagrant

The docs seem to say that also.

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/performing_an_advanced_rhel_installation/kickstart-commands-and-options-reference_installing-rhel-as-an-experienced-user

B.3.16. user

The user Kickstart command is optional. It creates a new user on the system.

Syntax

user --name=username [OPTIONS]

Mandatory options

--name= - Provides the name of the user. This option is required. 

Optional options

--password= - The new user’s password. If not provided, the account will be locked by default.

--iscrypted - If this option is present, the password argument is assumed to already be encrypted. This option is mutually exclusive with --plaintext. To create an encrypted password, you can use python:

I didn't do a PR as I'm using it with vSphere and not vagrant/virtualbox so couldn't test and confirm.

geerlingguy commented 4 years ago

Oh... nice catch! I'll test this out locally and see if that's the fix. Thanks so much for posting the issue!

belfast77 commented 4 years ago

No problem, very glad to help. I see you've updated Centos8, however it wasn't working for me in Centos7 also. I'm not using vagrant/virtualbox box, so not using the user "vagrant" with pass "vagrant".

I'm using the vsphere-iso builder instead and therefore creating a different "ansible" user. Do you think your user is perhaps being created automatically by Vagrant and not by the user directive in the centos7 ks.cfg?

geerlingguy commented 4 years ago

Hmm... that is strange—Vagrant doesn't create a default user, so maybe in CentOS 7 that directive worked still even without the explicit =? I'm updating it too now...

geerlingguy commented 4 years ago

For some reason it still doesn't work even with the correct syntax. I have no clue why, but adding the useradd seems to work, where the command:

user --name=vagrant --plaintext --password=vagrant --groups=vagrant,wheel

Does not.

I'll revert the 'fix' since that wasn't working and will keep it as is for now. Not a big deal IMO but it is a mystery.