LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-25-2004, 06:43 AM   #1
topcat
Member
 
Registered: Feb 2003
Distribution: ubuntu 6.06, ubuntu 7.04 AMD 64bit, 7.10 AMD 64bit
Posts: 62

Rep: Reputation: 15
HoW To Prevent Accidently halting remote server.!!!!!


Instead of shutting down a local server I did not realise i was currently on the remote live server and HALTED it down!
Yeah! how dumb is that!!.

I would like to know how I can prevent such accidental shutdowns. I know I need to be careful, but sometimes, when you are working 16 hours at a stretch it kindof leaves your senses numb and one invariably ends up making mistakes.

Please tell me there is a solution beyond the "you got to be careful" .. please please.

thanks!
tc
 
Old 11-25-2004, 07:17 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
i guess the immediate answer might be to rename halt... but that would presumably break other dependent scripts.

I've not tried it but i'd suggest setting a login level alias, which i *think* will take precendence over files.
Code:
export alias halt='echo you're on the main server, fool.... use the absolute path to really run halt'
i can't see why that would affect anythign outside of your login shell, so anything calling halt as root would get the real deal /bin/halt. but when logged in as root (i'm assuming that alias is done in /root/.bashrc btw.) then running "halt" without thinking will give a pleasantly goading message, rather than taking the server down, requiring /bin/halt to be required explictly to kill the box.

now comes the part where someone says that's drivel.....

but then again, it's down to being careful... but in an official way, i.e you shouldn't BE root in the first place, you should be sudoing etc... and not have access to halt as your sudoer, but only as real root. so while your sudo user can "rm -rf /home" they can't shut the machine down by mistake.
 
Old 11-25-2004, 07:21 AM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

You could remove execute permissions for halt, shutdown, poweroff etc.

If you want to shut down, just reinstate execute permissions.

Dave
 
Old 11-26-2004, 08:15 PM   #4
topcat
Member
 
Registered: Feb 2003
Distribution: ubuntu 6.06, ubuntu 7.04 AMD 64bit, 7.10 AMD 64bit
Posts: 62

Original Poster
Rep: Reputation: 15
thanks. The problem is that i have not been sudoing. but then is there a difference betwen su and su -

though i must also point out that when on my local machine (redhat 9.0 ) i was logged on as normal user and to test out i typed halt, i still got the system to halt. so its not like ROOT is the only one who can halt. how does it work now??
 
Old 11-27-2004, 12:54 PM   #5
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
The difference between su and su - is that su - acts as a login shell for root, while su just changes your userid to 0.

What I was suggesting was to remove execute permissions from halt, shutdown etc by doing chmod -x, that way no-one can issue any of those commands without reinstating execute permissions.

Dave
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SENDMAIL - How to prevent telnet into my server on port 25 adamrau Linux - Software 4 04-19-2010 07:17 PM
How to have prevent X server to... melopll *BSD 4 08-29-2005 05:45 PM
how to prevent x server from starting? iansworld Fedora 5 02-20-2005 03:40 AM
Prevent other to ping the server kelper Linux - Security 2 09-04-2003 04:50 AM
How to prevent X server from opening port 6000 glock19 Linux - General 5 05-23-2002 03:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration