Daneel Yaitskov
2012-Apr-20 13:48 UTC
[Libguestfs] Cannot login after modification shadow file with guestmount
Hi. I have a VM with CentOs6.2 on KVM. I mount an image of the VM when it's not working with guestmount: root at diehard:~# guestmount -a named-centos.img -i tmp vi /etc/shadow insert comment line into the file (esc yy p 0 i # esc :wq!), save changes, unmount the image, turn on the VM, and I cannot login. I cannot login even if I recover the shadow file. root at diehard:~# guestmount --version guestmount 1.16.15 -- ?????? ?????? ????????? Daneel S. Yaitskov skype: daneel_s_yaitskov google talks: rtfm.rtfm.rtfm at gmail.com email: dy at hivext.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libguestfs/attachments/20120420/1605f3c5/attachment.htm>
Richard W.M. Jones
2012-Apr-20 21:49 UTC
[Libguestfs] Cannot login after modification shadow file with guestmount
On Fri, Apr 20, 2012 at 05:48:06PM +0400, Daneel Yaitskov wrote:> I have a VM with CentOs6.2 on KVM. I mount an image of the VM when it's > not working with guestmount: > > root at diehard:~# guestmount -a named-centos.img -i tmp > > vi /etc/shadowHopefully you edited the guest's tmp/etc/shadow, not your host's /etc/shadow ...> insert comment line into the file (esc yy p 0 i # esc :wq!), save changes, > unmount the image, turn on the VM, and I cannot login. > > I cannot login even if I recover the shadow file.Not much information to go on here, but my guess is that /etc/shadow has the wrong permissions or SELinux context after you edited it. We recently fixed this bug in virt-edit: https://bugzilla.redhat.com/show_bug.cgi?id=788641 but that doesn't help you if you're using guestmount. These are what they should be on a RHEL 6 system: $ ll -Z /etc/shadow ----------. root root system_u:object_r:shadow_t:s0 /etc/shadow If that doesn't help, have a look for the error (/var/log/messages, /var/log/secure, or /var/log/audit/audit.log): $ guestfish --ro -a named-centos.img -i ><fs> less /var/log/messages [etc] Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/