From: Fergal Daly (fergal at domain esatclear.ie)
Date: Thu 17 May 2001 - 16:08:42 IST
Why not wrap your "dangerous" commands in a safety program, so that
init 1
becomes
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
init.real 1
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
use strict;
my $host = shift;
my $real_host = `/bin/hostname`;
chomp $real_host;
if ($host ne $real_host)
{
warn "You're on '$real_host' ya spanner\n";
exit 1;
}
# $0 contains the name we were called with
my $real_command = "$0.real";
exec($real_command, at domain 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 ...
>
> P
>
> > -----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 domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at domain linux.ie
--
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:10:20 GMT