Take the 2-minute tour ×

I have a Java program on my Linux box and I wanted to create a little one-liner shell script in /bin to prevent having to navigate to the folder of the program and setting all the command line arguments every time.

At first, I was able to run the script in /bin but Java would not start correctly. However, when executing the full command /xxx/yyy/zzz/javaprog -args it started. After a while, I realized that sudo /bin/shortcut was resolving the problem.

I then checked at the permissions:

java program  :  -rwxrwxr-x 1 fred fred
/bin/shortcut :  -rwxrwxrwx 1 root root

by issuing a chown fred /bin/shortcut changed the owner to:

-rwxrwxrwx 1 fred root

and now everything is fine and I don't have to sudo the shortcut.

Can somebody help me a little bit to understand what's happening? Why I needed to sudo the shortcut to make it work, or change its owner to the one of the Java program.

PS. I understand the concept of user/group

share|improve this question
The usual permission on programs (owned by root:root) in /bin is -rwxr-xr-x, which is enough to be run by everyone (as pointed out by Demure and Jason), so the problem you are facing should originate from something else. Can you please provide /bin/shortcut and also the error message you got previously? –  mpy May 23 '13 at 19:08
In fact, I have no error message : the Java process just don't start (cannot see it with top) and the script return. The content of the script is just a sh shebang with the path to software with args. I also use nohup /pathToProgram & so the program won't stop –  Speccy May 23 '13 at 19:17
(1) I don’t understand what’s happening –– it doesn’t make any sense. Standard debugging techniques apply: try putting other commands (such as echo and date) into the “shortcut” and see whether they run. Do ls –lu /xxx/yyy/zzz/javaprog before and after running the script, to see whether javaprog is accessed. (2) “shortcut” is not a great name for a script; it’s a little misleading. (3) Even if this is your own, home, personal computer, that nobody but you uses, I suggest that you avoid getting in the habit of putting world-writable files in /bin. –  Scott May 23 '13 at 23:25

2 Answers 2

you understand that rwxrwxrwx are the permissions for your files/folders right? the first three RWXrwxrwx is for the owner of the file. The second set of three, rwxRWXrwx is for the group owner of the file or folder and the last set of three, rwxrwxRWX is for everyone else on the system. R = read, W = write, and X = execute.

Chown just assigns the user and the group to the file/folder

If I'm off the mark clarify your question.

share|improve this answer

Linux permissions consist of Owner, Group, and Other.

Your java program : -rwxrwxr-x 1 fred fred means that the file is owned by 'fred', and the group is 'fred'. Fred can read, write and execute this file (the first rwx). People in Group 'fred' can read, write and execute this file (the second rwx). All other users can read and execute this file (the third part, r-x).

For /bin/shortcut : -rwxrwxrwx 1 root root, root is the owner and group, and all users can read, write, and execute.

After your chown fred /bin/shortcut, which probably should have been chown fred:fred /bin/shortcut (to change group too), Owner is fred, group is root, and all users can read, write, and execute.

share|improve this answer

Your Answer


