Free tools / cloud-init generator
Cloud-init user-data generator
Create a #cloud-config file that sets up a new Ubuntu or Debian server on first boot: a sudo user with your SSH key, root and password login turned off, updates, a firewall, fail2ban and automatic security updates. Copy it or download it as a .yaml file.
Everything runs in your browser. Nothing you type is sent to a server or stored.
User and SSH
Packages and system
Security services
- No SSH key added. With password login off you will not be able to log in. Paste your public key.
#cloud-config
# Generated at nocthost.com/tools/cloud-init-generator
users:
- name: "deploy"
groups: [sudo]
shell: /bin/bash
sudo: "ALL=(ALL) NOPASSWD:ALL"
lock_passwd: true
# Block root over SSH and turn off SSH password login
disable_root: true
ssh_pwauth: false
package_update: true
package_upgrade: true
packages:
- "curl"
- "git"
- "htop"
- "ufw"
- "fail2ban"
- "python3-systemd"
- "unattended-upgrades"
timezone: "UTC"
write_files:
- path: /etc/fail2ban/jail.local
defer: true
content: |
[sshd]
enabled = true
port = 22
backend = systemd
maxretry = 5
findtime = 10m
bantime = 1h
- path: /etc/apt/apt.conf.d/20auto-upgrades
defer: true
content: |
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
runcmd:
- "ufw default deny incoming"
- "ufw default allow outgoing"
- "ufw limit 22/tcp"
- "ufw allow 80/tcp"
- "ufw allow 443/tcp"
- "ufw --force enable"
- "systemctl enable fail2ban"
- "systemctl restart fail2ban"
- "systemctl enable --now unattended-upgrades"
How to use
- Paste your SSH public key, the line that starts with ssh-ed25519 or ssh-rsa. Without it you cannot log in once password login is off.
- Choose the packages, firewall ports and extras you want on the server.
- Copy the output or download it as user-data.yaml.
- Paste it into the user data or cloud-init field when you create a server, or pass the file to your provider's CLI. Optionally validate it first with cloud-init schema -c user-data.yaml.
- After the first boot, log in as the new user and check /var/log/cloud-init-output.log if something did not run.
Frequently asked questions
Where do I put this file?
Most cloud providers have a user data or cloud-init field in the create server form, and their CLIs and APIs accept the same content. cloud-init reads it once, on the first boot of a new server.
Does it work on an existing server?
Not as is. cloud-init runs these modules only on the first boot of an instance. On a server that is already running, run the equivalent commands by hand, or use the sshd and ufw generators on this site.
Which distributions does it support?
The output targets Ubuntu 22.04 and newer and Debian 12 and newer, which ship cloud-init in their cloud images. The sudo group, the package names and the unattended-upgrades setup are Debian family specifics.
How do I check that it ran?
Run cloud-init status --long after logging in. Output from package installs and runcmd is in /var/log/cloud-init-output.log, and errors are in /var/log/cloud-init.log.
Further reading
More free tools
- SSH hardening config generatorKey-only login, root off, AllowUsers, timeouts and modern ciphers as a drop-in or a full sshd_config.
- UFW firewall rules generatorOrdered ufw commands from presets or custom ports, with SSH allowed before the firewall turns on.
- WireGuard config generatorA server wg0.conf and up to 10 client configs with browser-generated keys, NAT rules and setup commands.
- Nginx reverse proxy config generatorAn nginx server block for a local app with Let's Encrypt HTTPS, WebSocket, redirects, gzip and rate limiting.
- Systemd service file generatorA .service unit for your app with user, environment, restart policy and optional hardening, plus the enable commands.
Need a server to try it on? Deploy a Debian VPS