Kevin McKeon
2009-May-22 20:02 UTC
[Xen-users] can the root password be recovered from a DomU
Just curious if anyone knows this. If you loose the root password on a Linux box, you can just boot from CDRom, mount the root partition and edit /etc/shadow. Is it possible to do something similar with a DomU. I tried: mount -o loop mydisk.img /mnt but I got an error saying something like "you must specify a filesystem type" mount -o loop -t ext3 mydisk.img /mnt does NOT work either (I''ve also tried moving the ''-t ext3'' part but no go) _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Wickberg
2009-May-22 20:12 UTC
Re: [Xen-users] can the root password be recovered from a DomU
Assuming your image file has been partitioned, you''ll need to specify the offset to the start of the partition you want to mount. Otherwise you''re trying to mount the partition table as a filesystem, which is why you see the "must specify a filesystem type" error. What you want (assuming you want the first partition, which starts at block 62 * 512 bytes/block) is: mount -o loop,offset=$((62*512) mydisk.img /mnt A few quick references: http://darkdust.net/writings/diskimagesminihowto http://www.openclose.it/creare_e_usare_un_disco_immagine.do Kevin McKeon wrote:> Just curious if anyone knows this. If you loose the root password on a > Linux box, you can just boot from CDRom, mount the root partition and > edit /etc/shadow. > Is it possible to do something similar with a DomU. > > I tried: > mount -o loop mydisk.img /mnt > but I got an error saying something like "you must specify a filesystem > type" > mount -o loop -t ext3 mydisk.img /mnt does NOT work either (I''ve also > tried moving the ''-t ext3'' part but no go)_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Joe Armstrong
2009-May-22 20:20 UTC
Re: [Xen-users] can the root password be recovered from a DomU
You can try this from dom0 (in this example the domU uses LVM): kpartx -av /var/lib/xen/images/vm2.img You may need to install kpartx yourself, not sure if it comes "free inside" (yum search kpartx on CentOs) maps disk partitions to device table entries uses losetup to create loop devices to disks vgscan To find volume groups on the newly mapped disk vgchange -ay VM_VG00 Activate the volume group you need, VM_VG00 is just an example... mount /dev/VM_VG00/VM_LV00 /mnt Mount the filesystem you want, Make your changes umount /mnt vgchange -an VM_VG00 kpartx -dv /var/lib/xen/images/vm2.img To unwind things. Joe ----- Original Message -----> From: xen-users-bounces@lists.xensource.com <xen-users-bounces@lists.xensource.com> > To: Xen-users@lists.xensource.com <Xen-users@lists.xensource.com>, Kevin McKeon <kevin.w.mckeon@gmail.com> > Sent: Friday, May 22, 2009 1:03:16 PM GMT-0800 America;Los_Angeles > Subject: [Xen-users] can the root password be recovered from a DomU> > Just curious if anyone knows this. If you loose the root password on a > Linux box, you can just boot from CDRom, mount the root partition and > edit /etc/shadow. > Is it possible to do something similar with a DomU. > > I tried: > mount -o loop mydisk.img /mnt > but I got an error saying something like "you must specify a > filesystem type" > mount -o loop -t ext3 mydisk.img /mnt does NOT work either (I''ve also > tried moving the ''-t ext3'' part but no go)_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Antonis Kouzoupis
2009-May-23 12:35 UTC
Re: [Xen-users] can the root password be recovered from a DomU
Also you can mount the image, mount -o loop disk.img lala/ then chroot to the mounted directory chroot lala and passwd to change the password -- antonis kouzoupis _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tanuj Bansal
2009-May-25 05:19 UTC
[Xen-users] Re: can the root password be recovered from a DomU
How can I do this on a file DomU config file disk = [ "tap:aio:/mnt/Domu/server.dsk,xvda,w" ] I can mount this server.dsk file''s partitions using losetup and kpartx But how to mount this whole file in a single directory to use chroot _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha
2009-May-25 06:18 UTC
Re: [Xen-users] Re: can the root password be recovered from a DomU
On Mon, May 25, 2009 at 12:19 PM, Tanuj Bansal <bansal.tanuj83@gmail.com> wrote:> How can I do this on a file > DomU config file > disk = [ "tap:aio:/mnt/Domu/server.dsk,xvda,w" ] > > I can mount this server.dsk file''s partitions using losetup and kpartx > But how to mount this whole file in a single directory to use chrootWith that setup, you don''t mount the whole file. You mount its partitions (which apparently you already do). So for example if your domU root is on xvda1, and you use losetup and kpartx to make it available as /dev/mapper/loop0p1, and you already mount it on /mnt, you simply have to run "chroot /mnt" Other setups require you to mount the whole file, or use LVM, but from what you describe you don''t need those. -- Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Alain Barthe
2009-May-25 07:48 UTC
Re: [Xen-users] can the root password be recovered from a DomU
Try to use this tool : http://www.albar.fr/downloads/vbdmount.py 2009/5/22 Kevin McKeon <kevin.w.mckeon@gmail.com>> Just curious if anyone knows this. If you loose the root password on a > Linux box, you can just boot from CDRom, mount the root partition and edit > /etc/shadow. > Is it possible to do something similar with a DomU. > > I tried: > mount -o loop mydisk.img /mnt > but I got an error saying something like "you must specify a filesystem > type" > mount -o loop -t ext3 mydisk.img /mnt does NOT work either (I''ve also tried > moving the ''-t ext3'' part but no go) > > > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users