sch sch - 1 year ago 90
Linux Question

Proper use of '/opt' folder on linux

Linux System:

Ubuntu 14.04 LTS

I copy some app (like
) to the
folder to be used also by another user-accounts. Then to start it I use:

sudo /opt/xxx_folder/xxx

(of course, links to /usr/local/bin or /usr/bin, etc.) to start it;

Problem: I'm storing the results/projects of the app to my local folder ( like
). And of course the folder and it's data
belongs to
). So I have to change the owner every time I want to edit those files using another app not as a root.

Question: is there a way to install an app
so, that I don't need to start them as a root?

OR maybe you see another way to solve this 'root-user-problem?'

Answer Source

You can add execute permission to any file like this.

sudo chmod +x

If you want to do that for all files in that folder try this:

sudo chmod +x /opt/*

Note the +x just adds execute permission to your logged in user. I think all users have read (+r) by default so if you also want to add write permission:

sudo chmod +xw /opt/*

Personally I keep all my custom scripts in a bin folder e.g. /opt/bin/ and just do:

sudo chmod +x /opt/bin/*

To run the script without the full path add the bin or full opt folder to your path by adding the following to ~/bashrc file:


If you don't end up using the bin folder, edit above to be /opt instead of /opt/bin.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download