Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #cloud-config
  2. # Configures a basic Ubuntu box.
  3. # * Installs a few common packages
  4. # * Disables root login
  5. # * Disables password login
  6. # * Creates a user in the sudo, www-data groups
  7. #
  8. # Follow the log by ssh-ing in and running: `tail -f /var/log/cloud-init-output.log`
  9. apt_update: true
  10. apt_upgrade: true
  11. packages:
  12. - build-essential
  13. - curl
  14. - g++
  15. - gcc
  16. - git
  17. - libssl-dev
  18. - make
  19. - openssl
  20. users:
  21. - name: USER
  22. groups: sudo
  23. shell: /bin/bash
  24. sudo: ['ALL=(ALL) NOPASSWD:ALL']
  25. lock-passwd: true # no password login
  26. ssh-authorized-keys:
  27. - PUB_KEY
  28. groups:
  29. - www-data: [USER]
  30. runcmd:
  31. # Disable root ssh login and add our own new user: USER
  32. - echo "Editing sshd_config"
  33. - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
  34. - sed -i -e '$aAllowUsers USER' /etc/ssh/sshd_config
  35. - service ssh restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement