Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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:
- - build-essential
- - curl
- - g++
- - gcc
- - git
- - libssl-dev
- - make
- - openssl
- users:
- - name: USER
- groups: sudo
- shell: /bin/bash
- sudo: ['ALL=(ALL) NOPASSWD:ALL']
- lock-passwd: true # no password login
- ssh-authorized-keys:
- - PUB_KEY
- groups:
- - www-data: [USER]
- runcmd:
- # Disable root ssh login and add our own new user: USER
- - echo "Editing sshd_config"
- - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
- - sed -i -e '$aAllowUsers USER' /etc/ssh/sshd_config
- - service ssh restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement