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.
Hi there,
I don’t think that this is available out of the box, but what you could do is to pass a
user_data
parameter with a shell script or a ‘cloud-config’ configuration withHere 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!
Best,
Bobby
Hello @trentseal
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
doctl
command line tool, you can pass in the script using the--user-data-file
option: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.
Regards