
How to Use cloud init and User Data for Server Setup
Use cloud-init and user data to set up a server at first boot: users, SSH keys, packages, files and commands, plus how to debug a run that did nothing.
Tag
7 posts

Use cloud-init and user data to set up a server at first boot: users, SSH keys, packages, files and commands, plus how to debug a run that did nothing.

Validate input in a shell script by checking arguments, using allow lists, rejecting leading dashes, and quoting values before they reach commands.

Use named capture groups in regex: syntax in JavaScript, Python, PCRE and .NET, referring back by name, replacing with names and what grep, sed and awk lack.

Run Docker containers as a non root user: the USER instruction, creating a user, file ownership, ports below 1024, and the runtime --user flag.

Create groups with groupadd, add users with usermod -aG and gpasswd, list memberships with id, and learn why a new group needs a fresh login to take effect.

Add, modify and delete users on Linux with useradd, adduser and userdel, set the home directory and shell, and know which defaults a system account needs.

Create database users and grants from the shell for PostgreSQL and MySQL: least privilege, passwords kept off the command line, idempotent scripts and checks.