In this vein, I set my PS1 to bold red capital letters on bastion hosts and alias sudo="echo 'You're on a jump box moron :p'"
I do the tmux color trick too-- color coded by environment for each bastion.
Re:I've screwed up plenty of things too
by PeterisP on Tuesday February 11, 2020 @02:59PM
(#22302155)
Something like this to obviously distinguish environments is good practice - at one company we implemented scripts for terminal color-coding like this after some downtime caused by a destructive backup restore accidentally being run in the production environment instead of an acceptance testing system, which was in all aspects identical to the production system.
And I've seen a solution for more secure environments where physical separation was used with the operator having separate monitors/keyboards, and the "important" system having a different color keyboard and monitor frame.
Re:I've screwed up plenty of things too
by KajMagnus on Tuesday February 11, 2020 @09:26AM
(#22298696)
That's nice — I usually start my commands with `# ` but then there's no tab completion. I'll try `ls`
We do this for our database connections in Azure Data Studio / the Windows version of it. Really great idea.
One other "defensive scripting" trick I frequently use is starting any `rm` command with `ls`, double checking its output (or triple checking if it's a recursive one), and then replacing `ls` with `rm`. It barely takes any extra time if you're proficient with emacs-style readline hotkeys: