Skip to content

Instantly share code, notes, and snippets.

@jakeklassen
Last active December 10, 2017 10:06
Show Gist options
  • Save jakeklassen/7e113ee875bad6f133a7f43619eb7c90 to your computer and use it in GitHub Desktop.
Save jakeklassen/7e113ee875bad6f133a7f43619eb7c90 to your computer and use it in GitHub Desktop.
Digital Ocean cloud-config script for Ubuntu 16
#cloud-config
# Configures a basic Ubuntu box.
# * Installs a few common packages
# * Disables root login
# * Disables password login
# * Creates a user in the sudo, www-data groups
#
# Follow the log by ssh-ing in and running: `tail -f /var/log/cloud-init-output.log`
apt_update: true
apt_upgrade: true
packages:
- language-pack-en
- build-essential
- curl
- g++
- gcc
- git
- libssl-dev
- make
- openssl
users:
- name: app
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
lock-passwd: true # no password login
ssh-authorized-keys:
- PUB_KEY
runcmd:
# Disable root ssh login and add our own new user: app
# Also add dokku user to support commands over SSH
- echo "Editing sshd_config"
- sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
- sed -i -e '$aAllowUsers app dokku' /etc/ssh/sshd_config
- service ssh restart
@XedinUnknown
Copy link

XedinUnknown commented Dec 10, 2017

DO says that cloud-config is only available on CoreOS, Ubuntu 14, and CentOS 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment