Connecting to the wrong server

[Meme transcription:]

– Hey, why is the shell prompt on the production server red now?
– Earlier: me@prod:~$ docker container remove --force the-application

Protip: If you’re used to shutting down your computer via the CLI, make it a habit to use an alias like off.

This way you will never, ever turn off a remote server by accidentally using throwing poweroff at a residual SSH connection.

174 points · 12 comments · view on lemmy.world

12 Comments

Kidplayer_666@lemm.ee · 52 pts · 1y (3 replies)

Here we simply have a tool that on dangerous commands like power off or reboot asks for the host name of the machine in question. Didn’t stop me from accidentally rebooting a machine once, but no matter

derbolle@lemmy.world · 13 pts · 1y (1 reply)

sounds interesting. do you have the name of the tool or is it a custom script

Gyroplast@pawb.social · 26 pts · 1y

Probably molly-guard.

whodatdair@lemmy.blahaj.zone · 5 pts · 1y

Holy shit that’s brilliant

bleistift2@sopuli.xyz · 24 pts · 1y (5 replies)

If you’re using a descendant of Debian, you will find a line like this in your ~/.bashrc file:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

The 32m part controls the color of the username. (\u). 1 is red, 2 is green (as seen in the user and host part, \u@\h), 3 (as seen for the directory, \w) is blue.

You can use this to distinguish different hosts by color.

30p87@feddit.org · 12 pts · 1y (3 replies)

Oh, so we're Winkelschleifern prompts now?

As normal user, the username is also green, and the # is a $

Username@feddit.org · 6 pts · 1y (2 replies)

Zangendeutsch leckt oder Autokorrektur?

30p87@feddit.org · 3 pts · 1y (1 reply)

Zangendeutsch war zu verlockend.

bleistift2@sopuli.xyz · 4 pts · 1y

Zangendeutsch ist zu hoch für mich.

fidgeting9658@lemmings.world · 9 pts · 1y

Shell colors change the game really. I did this at work; when I'm on the admin server my prompt is rainbow, other servers black (I use a solarized light terminal). It has saved me so many times.

GreenKnight23@lemmy.world · 18 pts · 1y
[ removed ]
cupcakezealot@lemmy.blahaj.zone · 8 pts · 1y

this is honestly my worst fear as someone who suffers from ocd and compulsive checking

timbuck2themoon@sh.itjust.works · 3 pts · 1y

Man it's late here but I just don't get it. Isn't tmux enough to separate sessions then you just look before you run something like this?