Difference between revisions of "General Notes: Adding password to Centos image"

From Define Wiki
Jump to navigation Jump to search
(Created page with "Install guestfish: <syntaxhighlight> yum install guestfish -y </syntaxhighlight> Generate an encrypted password: <syntaxhighlight> openssl passwd -1 new_password </syntaxhighlight> Use guestfish to edit /etc/shadow...")
 
(Add a not on guestfish container)
 
Line 3: Line 3:
 
<syntaxhighlight>
 
<syntaxhighlight>
 
yum install guestfish -y
 
yum install guestfish -y
 +
</syntaxhighlight>
 +
or use this container:
 +
 +
<syntaxhighlight>
 +
docker run --rm -it --entrypoint /bin/bash -v <your-image>:/image:rw registry.vscaler.com:5000/docker-guestfish:latest
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 09:04, 28 October 2019

Install guestfish:

yum install guestfish -y

or use this container:

docker run --rm -it --entrypoint /bin/bash -v <your-image>:/image:rw registry.vscaler.com:5000/docker-guestfish:latest

Generate an encrypted password:

openssl passwd -1 new_password

Use guestfish to edit /etc/shadow inside the rhel-7-guest image:

guestfish -a rhel-7-server-guest-image.qcow2
><fs> run
><fs> list-filesystems
><fs> mount /dev/sda1 /
><fs> vi /etc/shadow

Replace the root encrypted password in /etc/shadow with the new one you just generated.

Edit the /etc/ssh/sshd_config file and uncomment the following line:

PermitRootLogin Yes

Now you can quit guestfish

><fs> quit

You should now be able to import the the guest image into OpenStack and once deployed, login as root using the password you set above, in addition to the normal mechanism using the OpenStack key pair.