Disable a command


 
Thread Tools Search this Thread
Operating Systems AIX Disable a command
# 8  
Old 06-10-2014
I do agree with Don, this might help you

1. change directory permission first, so that only the user can edit contents of home directory
Code:
chmod 755 /home/user

2. Disable loading of .bashrc file, will move to some safe place...
Code:
mv /home/user/.bashrc /root/some_safe_place/backup/

3. Create a .bash_profile file and add all alias
Code:
touch /home/user/.bash_profile

Some_restricted functions file look like this
Code:
$ cat somefile

# some disabled aliases
alias ls="echo ls "  
alias rm="echo rm" 

# Some allowed aliases
alias f='ferret -nojnl'
alias cls='clear'
alias cp='/bin/cp -i'
alias mv='/bin/mv -i'
alias md='mkdir'
alias m='/usr/local/Software/Matlab_09/bin/./matlab'
alias ncml='/usr/local/www/html/TOMCAT_DEMO/tomcat/JAVA/jre1.7.0_45_64/bin/java -jar /home/akshay/Documents/toolsUI-4.2.jar &'

.bash_profile will be something like this
Code:
# Get the aliases and functions
if [ -f ~/.somefile ]; then
	. ~/.somefile
fi

# Some User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH

4. Change the ownership of the user's .bash_profile to root
Code:
chown root:root /home/user/.bash_profile

5. Disable write permission
Code:
chmod 755 /home/user/.bash_profile

This User Gave Thanks to Akshay Hegde For This Post:
# 9  
Old 06-10-2014
Or just remove the (execute) rights for the group "other",
which means that only the owner (in most cases "bin") or "root" will be able to execute this command.

example:
chmod 550 /usr/bin/<your_secure_command>

verify:
ls -la /usr/bin/<your_secure_command>
-r-xr-x--- 1 bin bin 26990 Sep 05 2012 /usr/bin/<your_secure_command>

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Not able to disable finger & telnet command in Solaris 8

Hi I need to disable finger & telnet command in solaris 8 I have put the # infront of finger and telnet line in /etc/inetd.conf file. Further I have run the below command kill -1 <process id of inetd > But when I am running finger command it is till giving information for remote machine... (8 Replies)
Discussion started by: amity
8 Replies

2. OS X (Apple)

Disable / mute microphone from command line

Googling suggested "osascript -e 'set volume 0' " but that doesn't work. I know I'd found this before... some command-line utility that had something to do with audio, mixers, whatever, but I forgot to keep it somewhere I could find it. I did find references to writing an AppleScript app, but... (3 Replies)
Discussion started by: jnojr
3 Replies

3. Red Hat

SSL/TLS renegotiation DoS -how to disable? Is it advisable to disable?

Hi all Expertise, I have following issue to solve, SSL / TLS Renegotiation DoS (low) 222.225.12.13 Ease of Exploitation Moderate Port 443/tcp Family Miscellaneous Following is the problem description:------------------ Description The remote service encrypts traffic using TLS / SSL and... (2 Replies)
Discussion started by: manalisharmabe
2 Replies

4. Red Hat

command line tool to disable screen lock and/or screen saver

Hi, I have a simple question : how to disable screen lock and/or sreen saver with command line with RHEL5.4 ? (1 Reply)
Discussion started by: albator1932
1 Replies

5. 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

6. Shell Programming and Scripting

How to disable backslash in command line

Dear I have one problem in SCO Unix command line. I want to disable execution of commands with backslash. For example - if the user executes the following command \exec_script Here - i want the system should NOT execute this command. Can any one give me a suitable... (8 Replies)
Discussion started by: subbu62
8 Replies

7. UNIX for Dummies Questions & Answers

how to disable su command without the "-"

hello all i need to disable the su without "-" with another meaning i need to force executing of the .profile when using su command any ideas ??? (4 Replies)
Discussion started by: islam.said
4 Replies

8. Shell Programming and Scripting

How to disable Enable/Disable Tab Key

Hi All, I have bash script, so what is sintax script in bash for Enable and Disable Tab Key. Thanks for your help.:( Thanks, Rico (1 Reply)
Discussion started by: carnegiex
1 Replies

9. Solaris

OBP command to enable/disable a processor

Hello experts.. How can i enable or disable a processor from OBP(OK prompt)? Thanks in advance... (8 Replies)
Discussion started by: younus_syed
8 Replies

10. UNIX for Advanced & Expert Users

Disable the `rm -f ` command

I wish to learn how to use the alias command in .cshrc I need to change some Unix commands, like : change "rm -f " into "rm -i " or to write small scripts using alias. (7 Replies)
Discussion started by: kamil
7 Replies
Login or Register to Ask a Question