Tuesday, January 10, 2017

Changing the password on the RHEL 7 kvm qcow2



[nutt@nutt-pc ~]$ sudo apt-get install libguestfs-tools
[sudo] password for nutt: 
Sorry, try again.
[sudo] password for nutt: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  archdetect-deb authbind curtin-common dbconfig-common dbconfig-pgsql
  distro-info docutils-common fonts-font-awesome formencode-i18n
  freeipmi-common freeipmi-tools ieee-data isc-dhcp-server
  libconfig-general-perl libdebian-installer4 libecap3 libfreeipmi16
  libibverbs1 libipmiconsole2 libipmidetect0 libirs-export141
  libisccfg-export140 libjs-angularjs libjs-modernizr libjs-sphinxdoc
  libjs-yui3-common libjs-yui3-full libjs-yui3-min librdmacm1
  linux-headers-4.4.0-21 linux-headers-4.4.0-21-generic linux-headers-4.4.0-28
  linux-headers-4.4.0-28-generic linux-headers-4.4.0-31
  linux-headers-4.4.0-31-generic linux-headers-4.4.0-34
  linux-headers-4.4.0-34-generic linux-headers-4.4.0-38
  linux-headers-4.4.0-38-generic linux-headers-4.4.0-42
  linux-headers-4.4.0-42-generic linux-headers-4.4.0-43
  linux-headers-4.4.0-43-generic linux-headers-4.4.0-45
  linux-headers-4.4.0-45-generic linux-headers-4.4.0-47
  linux-headers-4.4.0-47-generic linux-image-4.4.0-43-generic
  linux-image-4.4.0-45-generic linux-image-4.4.0-47-generic
  linux-image-extra-4.4.0-43-generic linux-image-extra-4.4.0-45-generic
  linux-image-extra-4.4.0-47-generic postgresql pxelinux
  python-babel-localedata python-django-common python3-alabaster python3-attr
  python3-babel python3-bson python3-bson-ext python3-convoy python3-crochet
  python3-curtin python3-distro-info python3-django python3-django-piston3
  python3-djorm-ext-pgarray python3-dnspython python3-docutils python3-ecdsa
  python3-formencode python3-iso8601 python3-jsonschema python3-mimeparse
  python3-netaddr python3-netifaces python3-oauth python3-pam python3-paramiko
  python3-pbr python3-petname python3-prettytable python3-psycopg2
  python3-pyasn1-modules python3-pygments python3-pyvmomi python3-roman
  python3-seamicroclient python3-serial python3-service-identity
  python3-simplejson python3-simplestreams python3-sphinx
  python3-sphinx-rtd-theme python3-sqlparse python3-tempita python3-twisted
  python3-txtftp python3-tz python3-yaml python3-zope.interface sphinx-common
  sphinx-rtd-theme-common squid squid-common squid-langpack tgt
  ubuntu-cloudimage-keyring
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  btrfs-tools cryptsetup cryptsetup-bin dmeventd dmsetup extlinux hfsplus
  libconfig9 libdevmapper-event1.02.1 libguestfs-hfsplus libguestfs-perl
  libguestfs-reiserfs libguestfs-xfs libguestfs0 libhfsp0 libhivex0
  liblvm2app2.2 liblvm2cmd2.02 libreadline5 libstring-shellquote-perl
  libsys-virt-perl libwin-hivex-perl libxml-xpath-perl lsscsi lvm2 lzop mdadm
  reiserfsprogs scrub supermin xfsprogs zerofree
Suggested packages:
  keyutils libguestfs-gfs2 libguestfs-jfs libguestfs-nilfs libguestfs-rescue
  libguestfs-rsync libguestfs-zfs thin-provisioning-tools default-mta
  | mail-transport-agent xfsdump quota
The following NEW packages will be installed:
  btrfs-tools cryptsetup cryptsetup-bin dmeventd dmsetup extlinux hfsplus
  libconfig9 libdevmapper-event1.02.1 libguestfs-hfsplus libguestfs-perl
  libguestfs-reiserfs libguestfs-tools libguestfs-xfs libguestfs0 libhfsp0
  libhivex0 liblvm2app2.2 liblvm2cmd2.02 libreadline5
  libstring-shellquote-perl libsys-virt-perl libwin-hivex-perl
  libxml-xpath-perl lsscsi lvm2 lzop mdadm reiserfsprogs scrub supermin
  xfsprogs zerofree
0 upgraded, 33 newly installed, 0 to remove and 14 not upgraded.
Need to get 10.5 MB of archives.
After this operation, 48.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y


Generate encrypted password with openssl then copy output string and paste in shadow file in next steps


[nutt@nutt-pc KVM]$ openssl passwd -1 changeme
$1$twJh0TGA$ebVI529VkTMaICf0Oyvac/


[nutt@nutt-pc KVM]$ sudo guestfish --rw -a ./RHEL7_Node2.qcow2 

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> run
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
><fs> list-filesystems
/dev/sda1: xfs
><fs> mount /dev/sda1 /
><fs> df
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/root        4128448 424048   3494688  11% /
tmpfs              97548    292     97256   1% /run
/dev              240748      0    240748   0% /dev
/dev/sda1        8181760 970692   7211068  12% /sysroot

><fs> vi /etc/shadow
><fs> quit



Reference: https://access.redhat.com/discussions/664843














No comments:

Post a Comment