-
-
Save styk-tv/7f551afa26d01f6ac8d44b67874f3278 to your computer and use it in GitHub Desktop.
Adding ssh public key to Ubuntu cloud image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions for working with QEMU image come from | |
# https://www.kumari.net/index.php/system-adminstration/49-mounting-a-qemu-image | |
1. Download image http://cloud-images.ubuntu.com/ | |
2. Install qemu, nbd-client | |
3. Load the module | |
sudo modprobe nbd max_part=8 | |
4. Connect image | |
sudo qemu-nbd --connect=/dev/nbd0 Downloads/xenial-server-cloudimg-amd64-disk1.img | |
5. Mount image | |
sudo mount /dev/nbd0p1 /mnt/cd | |
6. Add the content of ~/.ssh/id_rsa.pub to /mnt/cd/home/ubuntu/.ssh/authorized_keys | |
7. Unmount image | |
sudo umount /mnt/cd | |
8. Disconnect the image | |
sudo nbd-client -d /dev/nbd0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment