Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What user and group should I chown it to? All admins are in 'admins' group. How do I chmod it?

share|improve this question
Why do you want to do that? Security doesn't come from making commands non-executable, it comes from the kernel preventing commands not running as root to do certain things. For example, if you want to prevent users from seeing each other's processes, preventing them from running ps is useless (ps is just a friendly formatter for information in /proc). What you need is to make the information restricted in the first place. – Gilles Apr 23 '11 at 12:30
up vote 1 down vote accepted

Most likely you just need to remove the world-executable permission:

sudo chmod o-x $(which command)

If the binary is owned by some group other than root, you probably want to set that to:

sudo chgrp root $(which command)
share|improve this answer
Is there a way to have a user get 'bash: blah: command not found' instead of 'bash: /usr/bin/blah: Permission denied'? @Caleb – user13764 Apr 23 '11 at 11:42
Not unless you move the command from the users $PATH and into something that is only in admin users $PATH. Generally it is a bad idea to move executable from their system installed defaults. You can do it, but think twice because you are going to make a real admin mess for yourself or somebody else down the road. – Caleb Apr 23 '11 at 11:58
@G26: Put in in /usr/local/sbin rather than /usr/local/bin. (If it was a standard system command in /usr/bin or /bin, you shouldn't do anything to it. – Gilles Apr 23 '11 at 12:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.