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...")
(No difference)

Revision as of 00:12, 14 November 2016

Install guestfish:

yum install guestfish -y

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.