# this is the name of an existing interface it will find and then configure with these settings - in ubuntu 20 this is ens192 # change the instance-id every time you make changes to cloud-init files or it may not apply the changes REPLACE THIS WITH YOUR SSH KEY FROM ~/.ssh/id_rsa.pub Run these commands to create the three config files: cat user-data In my case I am using VMWare and creating a machine from an OVA file.īasically you have to create 3 config files and then put them in an iso file which you then mount as a CD when you boot the VM and then cloud-init configures your machine. Here are the steps that worked for me to configure the SSH key and a few other things on the VM. Also, sudo privileges elevation for the ubuntu account is passwordless, but the account is locked by default. This means enabling a user with a public ssh key in the user-data YAML file. You have to use public / private key authentication method with ssh. By default, you can not ssh to the machine using the username and password or connect through the VNC console (the "graphical" VM window in Virtualbox). And if you change anything in user-data or meta-data you need to rebuild the iso or img. Remember that if you leave the seed / nocloud iso mounted, it will ovewrite the settings in the VM with those in the data files. You need genisoimage for this or the cloud-utils tool cloud-localds for this other option: cloud-localds my-seed.img my-user-data my-meta-data You can also have a meta-data for the hostname and other definitions: instance-id: set-an-unique-instance-name-idĪfter creating the files generate an iso file to load as a cdrom or dvd from the virtual manager: genisoimage -output nocloud.iso -volid cidata -joliet -rock user-data meta-data Here is a sample user-data cloud-config file, create it with your text editor, and respect the name or the seed file won't be a valid seed and won't work. I will not setup a password for root or the user, I'm creating instead a new user with SSH access via ssh public keys and allowing the user sudo permissions instead. I'm going to show the steps for the ISO mount mode. This is might be done via the -user-data or -user-data-file argument when you are running inline, or you can do it with the ISO. Generating and setting up SSH private keysĬloud-init's behavior can be configured via the user-data flag for inline commands or calling a YAML type config file with the settings to apply.If you are using the Ubuntu Cloud Images, you should use Cloud-Init for setting the initial configuration, it allows you to set up: Add it as IDE and master, then load the ISO generated below. If the VM doesn't include a dvd/cd device, you have to add one. You need the iso/img generated below for cloud-init and mount it in the dvd or cd device for the VM you imported.Optionally, point it to a raw file in your home, so you can see the log in case of problems. You should enable the serial port in the hardware settings for the VM.You can do this in the GUI or the command line. You can import the OVA as an appliance, use an IMG or VMDK disk.Boot the VM with the attached ISO image as a removable device.Create the user-data and meta-data files.Set the correct settings for Virtualbox.According to (1), the recommended way might be one among several options: root user with password, a new user with ssh key and sudo, others.).Why do you need to set a root password.It would be useful if you could add background information to the question, like:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |