I’m trying to create a Droplet via the API. Is there a way to set an SSH password? I would rather not use SSH keys.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
You can use Bobby’s suggestion to pass the user_data parameter to set the root password.
If you are creating a Droplet with the
doctlcommand line tool, you can pass in the script using the
If you do not want to use user data, you can also run the script manually over SSH once the server is booted up.
I’ll still recommend using ssh-keys as it’s more secure and you can also limit the access to the droplet to certain IP addresses as an additional step to tighten up the security.
I don’t think that this is available out of the box, but what you could do is to pass a
user_dataparameter with a shell script or a ‘cloud-config’ configuration with
Here is an example of such a Bash script:
This script will run on the initial Droplet boot up.
For the API call, you might have to convert this into 1 liner, eg:
Hope that this helps!