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