LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Create Linux Users on mounted disk image (https://www.linuxquestions.org/questions/linux-server-73/create-linux-users-on-mounted-disk-image-835461/)

jonnytabpni 09-30-2010 12:47 PM

Create Linux Users on mounted disk image
 
Hi Everyone,

I'm currently in the middle of developing an automatic system which can provision Linux VMs automatically.

Let's say I have a disk image which has a Linux distro installed on it. How would I change the root password on that, without having to boot the OS?

It would be nice if I could just simply run passwd with some switch to point to the /etc/shadow file on the (mounted) VM disk image..

Any help would be appreciated

Thanks

angel115 09-30-2010 01:34 PM

Hi jonnytabpni,

You can use chroot for that.

Ex:

your image is mounted in /mnt/myImage
Code:

chroot /mnt/myImage
passwd root
exit

That should do the trick.

jonnytabpni 09-30-2010 05:07 PM

angel115, Thanks!! :)


All times are GMT -5. The time now is 10:15 AM.