Super User is a question and answer site for computer enthusiasts and power users. 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

I have an application installed in /etc/mydir.

I have executed the following to remove the ability for users to execute this program.

chown root:group1 /etc/mydir -R
chmod 700 /etc/mydir -R

I created a new user and logged in as this user. The new user was not added to group1 However, I was able to execute this program by just typing the program name.

How can I stop users being able to run this using chmod and chown. Please let me know.

PS. the new users cannot cd into /etc/mydir but they can still execute using the program name.

share|improve this question
The executed program probably isn't actually in /etc/mydir. Try which programname and type programname (if bash is your shell) to determine what actually gets called when you type programname. – Daniel Beck Nov 8 '13 at 21:55
@DanielBeck Thank you! The alias to the program was actually pointing to a file in /usr/libexec/mydir. Once I ran chown and chmod on this folder, it worked as expected. I could have marked it as an answer if you typed it below. Thanks for your time! – slayernoah Nov 8 '13 at 22:08
It's not too late for that :-) – Daniel Beck Nov 9 '13 at 5:29
up vote 0 down vote accepted

You need to find out what actually happens when you type the name of the program:

Use which <programname> to determine the location of the executable that gets executed when you type <programname>, which will be the first hit when trying the directories listed in the PATH environment in order. Use echo $PATH to find out where the shell looks for executables to run.

And just to be sure that your (bash) shell does not interfere, run type <programname> to find out whether aliases or functions are defined.

These will tell you that you're not actually running a program from the inaccessible directory, but from somewhere else.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .