Can anyone tell me, if this is a script that needs to be created or are these commands that need to be entered?

Now, I do know that some are commands. I have no idea what the rest are. And do I enter these from the MaaS server?

sudo apt-get install --assume-yes bzr             
bzr branch lp:~maas-maintainers/maas/backdoor-image backdoor-image    

imgs=$(echo /var/lib/maas/boot-resources/*/*/*/*/*/root-image)
for img in $imgs; do
    [ -f "$img.dist" ] || cp -a --sparse=always $img $img.dist
done    

for img in $imgs; do
    sudo ./backdoor-image/backdoor-image -v --user=backdoor --password-auth --password=ubuntu $img
done
share|improve this question

That is a shell script, and it needs to be run on the machine which holds the images in /var/lib/maas/boot-resources. Just save the whole script in a file like mk-backdoor.sh, add #!/bin/bash as first line, chmod +x mk-backdoor.sh and then execute it, possibly using sudo, like sudo ./mk-backdoor.sh. Be sure to update the values for username and password first.

What the commands are doing

Install bzr without user interaction:

sudo apt-get install --assume-yes bzr

Checks out the backdoor-image code:

bzr branch lp:~maas-maintainers/maas/backdoor-image backdoor-image

Collects the paths of all images in the boot-resources folder. The * stuff is more or less telling the command to go a certain number of folders deep, and look for a file called root-image:

imgs=$(echo /var/lib/maas/boot-resources/*/*/*/*/*/root-image)

This make copies of the images, if they didn't exist yet:

for img in $imgs; do
    [ -f "$img.dist" ] || cp -a --sparse=always $img $img.dist
done

This creates the backdoor user with username "backdoor" and password="ubuntu" on each image:

for img in $imgs; do
    sudo ./backdoor-image/backdoor-image -v --user=backdoor --password-auth --password=ubuntu $img
done
share|improve this answer
1  
how do you log in. – JUAN CABALLERO Jul 19 '14 at 1:07
    
Do you need to recommission ? – user1868 Oct 20 '14 at 13:51
    
No, you do not need to recommission, you login on the console of the system. – dpb May 12 '16 at 21:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.