LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] don't ya just hate it when...

[ILUG] don't ya just hate it when...

Fergal Daly 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 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, @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 linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie

-- 




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell