Skip to content

Instantly share code, notes, and snippets.

@AMSTKO
Forked from jakeklassen/cloud-init-dokku-post.yaml
Created November 17, 2017 21:25
Show Gist options
  • Select an option

  • Save AMSTKO/7f6f972b766f58b2b726a7b7545858f5 to your computer and use it in GitHub Desktop.

Select an option

Save AMSTKO/7f6f972b766f58b2b726a7b7545858f5 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment