Some application that installs automatically such as Netbean, JDK often install to /usr/local and I run it by normal user (not root).

But another application, just extract tar.gz file and run it. Under normal user, I cannot use cp command to copy from Download directory to /usr/local directory, I must use root user (su command).

But because I copy by root user this directory belongs to root, so I cannot run it under normal user. It makes my headache. How can I run it under normal user, as other application that I list above. Or, is there another way to install it?

2 Answers 2


/usr/local and its subdirectories (bin, lib, share, etc) should be (and likely are) owned root and set 755 so that anyone can execute stuff there.

If you unpacked something and copied it in, then it could be the permissions on the individual binaries, which should also be 755 to allow general use.

Keep in mind how $PATH works. Your example of the JDK may be confusing in this regard, but a normal tarball that you ./configure & make install will put executables in /usr/local/bin, libraries in /usr/local/lib, and miscellaneous things like documentation somewhere in /usr/local/share. Those are the appropriate paths, and you need to follow the same pattern. In other words, just putting stuff anywhere in /usr/local (such as an individual directory for the package) or subdirectories of bin/ will not work.


There are two potential issues you may be getting tripped up by.

First issue - execute permissions for directories

The permissions on one of the directories you copied into /usr/local may not have the permissions set correctly. The permissions on the directories needs to be such that users other than root, can execute the programs/scripts out of these directories.

The permissions on the directory probably need to be set so that "other" users are able to execute applications out of this directory.

For example

# don't have permissions on directory
root$ cd /usr/local
$ ls -ld somedir
drwxr-x--- 2 root root 4096 Apr 25 13:27 somedir

# have permissions on the script
root$ ls -l somedir/testscript.bash 
-rwxr-xr-x 1 root root 23 Apr 25 13:27 somedir/testscript.bash

In this scenario even though other users have execute permissions on the script to both read & execute it, they won't be allowed due to the fact they don't have read & execute on the directory the script is in.

Changing the permissions on the directory allows them access:

 user$ ls -ld somedir/
 drwxr-xr-x 2 root root 4096 Apr 25 13:27 somedir/

 user$ somedir/testscript.bash 

This entire issue can be resolved by changing the permissions in the directory being unpacked from the tar.gz file by finding all the directories that have scripts and running the command chmod +rx <dir> against these directories.

Second issue - execute permissions for files

The permissions on the files from the .tar.gz file may not have been set prior, so applications or scripts in the archive would've been unpacked missing these. Simply chmod +x <script> will resolve this issue on files that have this particular problem.

### For example
user$ ls -ld somedir
drwxr-xr-x 2 root root 4096 Apr 25 13:27 somedir/

user$ ls -l somedir/testscript.bash 
-rw-r--r-- 1 root root 23 Apr 25 13:27 somedir/testscript.bash

user$ somedir/testscript.bash
bash: somedir/testscript.bash: Permission denied

You must log in to answer this question.

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