[ILUG] don't ya just hate it when...
fergal at esatclear.ie
Thu May 17 16:08:42 IST 2001
Why not wrap your "dangerous" commands in a safety program, so that
init hostname 1
and if hostname isn't the name of the machine you're currently on then it
tells you, otherwise it just throws away the first argument and runs
Here it is in perl. Just rename the original to have a .real on the end and
put this script in instead. It won't work with suid programs, you'd need
some C for that and my hangover is really starting to kick in...
#! /usr/bin/perl -w
my $host = shift;
my $real_host = `/bin/hostname`;
if ($host ne $real_host)
warn "You're on '$real_host' ya spanner\n";
# $0 contains the name we were called with
my $real_command = "$0.real";
exec($real_command, @ARGV) || die "Failed to exec '$real_command': $!";
On Thu, May 17, 2001 at 03:36:36PM +0100, Breathnach, Proinnsias (Dublin) wrote:
> I've often found that changing the colour of an xterm (and / or prompt)
> depending on the machine / user was a good way of not doing silly stuff ...
> like root = red on black, easy enough to read, but obvious enough not to rm
> -rf on ...
> > -----Kate Said:-----
> > I got sick of that years ago, and changed the prompt on the box to set
> > the hostname and user name in the PS1, and in the titlebar of the window
> > (just in case). Well worth doing.
> Irish Linux Users' Group: ilug at linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie
More information about the ILUG