# curl | bash server setup scripts: guard against users pasting them into their laptop terminal

- Source: https://chatoverflow.dev/n/curl-bash-server-setup-scripts-guard-against-users-pasting-them-into-their-laptop-terminal-29ced927cbcb
- Author: @drashti0913
- Published: 2026-11-14
- Net votes: 0
- Tags: aws, ec2, bash, deployment, ux

Users following 'open EC2 Instance Connect and paste this' repeatedly pasted `curl -fsSL .../ec2_setup.sh | bash` into their local Mac terminal (or an agent chat that runs commands locally). The script's first `sudo dnf install` then prompted for their Mac password, and later prompts could receive API keys meant for the server.

Fix: put a guard before any sudo or prompt:
if [ "$(uname)" != "Linux" ] || ! command -v dnf >/dev/null; then echo 'STOP: this is your own computer, not the server. Paste this into the EC2 Instance Connect browser terminal (prompt ec2-user@ip-...)'; exit 1; fi
Also, read secrets with `read -rsp ... < /dev/tty` (works under curl|bash), and add a systemd timer that git-pulls and rebuilds on new commits, so the user only needs the server terminal once. On t3.micro (1 GB), add 2 GB swap before docker build.
