How can i disable force options for linux commands

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat How can i disable force options for linux commands
# 1  
Old 06-09-2009
How can i disable force options for linux commands

Sir ,

Is there any way for me to disable force (-f ) options to linux commands like rm. I tried to alias rm -f.
alias rm -f = "rm -i"

but it shows bad alias name error

I need this command specifically for rm. Atleast i want this command to be interactive whether I issue rm ,rm -rf , rm -r etc. Is there any way to do this..
# 2  
Old 06-09-2009
however, they can just "unalias 'rm -rf" and you are stuck.

How about you don't give that user the ability to use those binaries? additionally, you could learn about file permissions, noclobber, immutable settings as well as sticky bits.

Last edited by mark54g; 06-09-2009 at 12:57 PM..
# 3  
Old 06-09-2009
alias will not do what you want. You need to write a shell script wrapper around the rm command which removes the -f option from the command line argument list before passing the remaining arguments to the rm command.

Do a Web search for "shell script wrapper"
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Debian

Linux booting options

Here is my question, a few years back I was sitting in an airplane and saw the movie display for all the passengers in the back of all the seats boot up. You could see the all too familiar boot-up-scrolling text that we are all used to with Linux. But probably only a few other folks on the plane... (2 Replies)
Discussion started by: caleb8
2 Replies

2. Red Hat

Commands with options hang server

Hello Folks, when i run simple ls command i am getting the output properly. See below: # ls ecapPlat.err FileMover.log.2 FileScrubber.log.1 MeasServer.log mysentfile surv.log ecapPlat.log FileMover.log.3 FileScrubber.log.2 MeasServer.log.1 netConfig.err TimeServer.log FileMover.log... (1 Reply)
Discussion started by: manuswami
1 Replies

3. UNIX for Dummies Questions & Answers

Will Linux force NIC into promiscuous mode?

Right now I have a computer that I want to use as the monitor for my network. It's currently running Windows 7, and so as I understand it the NIC won't monitor all the traffic on the network. So my question is, if I install Linux on this computer will I be able to force the NIC card into... (1 Reply)
Discussion started by: iJeydon
1 Replies

4. Shell Programming and Scripting

Need to disable options from a command

Hi, I am working on a Linux machine. I need to disable 2 options from the available 6 options of a command. For eg. in the "ls" command we have various options like "l ,r, t, a, .... " From this, I need to disable option "a" So when the users type in "ls -a", they should get an error or... (4 Replies)
Discussion started by: aster007
4 Replies

5. Shell Programming and Scripting

Help with shell script to run the commands reading options from local file

I have to use shell script to run series of commands on another unix box by connecting through SSH and giving user credentials. For running commands on remote machine I have to use options reading from a local file. Process: Connecting to remote unix server <host1.ibm.com> through ssh Login: ... (2 Replies)
Discussion started by: itsprout
2 Replies

6. Shell Programming and Scripting

How to disable running commands from vi

Hello, We have a requirement to disable running shell commands via vi using "!". Can anybody please suggest how to disable this option. The requirement arises because we open up a xterm window with a config file in vi mode for the customer to edit. After the customer edits the config... (1 Reply)
Discussion started by: Umesh_Sharoff
1 Replies

7. UNIX for Dummies Questions & Answers

How can I force my Linux RedHat to recognize my modem??

yeah, I tried basically everything I can find from reading books and asking people but I haven't gotten it to work. is there anything else that can be done. I mean, this internal modem I got is like the last thing I expected Linux not to find (2 Replies)
Discussion started by: TRUEST
2 Replies
Login or Register to Ask a Question