![]() ![]() When you create the new instance (VM), you have to specify this key as the "keypair" you will use to log in for the first time. (Or you can "Create a Key Pair" from within the OpenStack GUI and then export the keys to your workstation.) by using ssh-keygen under Linux or macOS) and add it to the OpenStack keys by clicking on "Import Key Pair". In the OpenStack GUI, you manage your public/private keys under Project > Compute > Access & Security. Here are some details on how to log into a new Ubuntu instance for the first time, to complement answer. (Note that the password, apparently, may not be a valid field for the users specification, as it has a passwd hash instead, so, the whole thing breaks the prior code, because now the user ubuntu gets created without a password.) Here's the code to get the keys into a format that's potentially legible for cloud-config: printf "users:\n - name: ubuntu\n ssh-authorized-keys:\n" > user-dataĬat ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys | sed 's/^/ - /g' > user-data ![]() I've also tried playing with adding the ssh-authorized-keys, but cloud-config format seems very fragile, and at top level it's just ignored, whereas at a users: level as below, the whole ubuntu user seems to break (at least the password part of it). The user ubuntu gets passwordless sudo access as root by default. The login can be either through the serial console printed by kvm (which would normally be pretty slow, even if you have an ssh connection on top of it), or through ssh with ssh -p1810. You can then login into the machine as user ubuntu and the password as generated within the user-data file. Kvm -m 2048 -smp 2 -hda -hdb user-data.img -net nic -net user,hostfwd=tcp::1810-:22 -nographic Subsequently, you'd start the image like this, from within a tmux window to make sure it'll keep running even if you logout: cloud-utils/bin/cloud-localds user-data.img user-data Printf "password: `pwgen 8 1`\nchpasswd: \nssh_pwauth: True\n" > user-data ![]() The following code could be used to make the Ubuntu cloudimg usable on a Debian 7.2 (wheezy) machine: apt-get install pwgen ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |