Last active
December 10, 2017 10:06
-
-
Save jakeklassen/7e113ee875bad6f133a7f43619eb7c90 to your computer and use it in GitHub Desktop.
Digital Ocean cloud-config script for Ubuntu 16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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
DO says that
cloud-config
is only available on CoreOS, Ubuntu 14, and CentOS 7.