10

I heard that a coworker saying that he install all his software in /opt. I took a look on the Internet to check this was true and found that tldp.org website said:

[/opt] is reserved for all the software and add-on packages that are not part of the default installation.

So ok, it looks like he is right, so I tried to install Android Studio to this folder and was rejected as I'm not root...

So I would like to know, why, by default, this folder is detained by root user and if I can, without any problem chown it to my user.

2
  • Whats wrong with /usr/bin or ~/bin ?
    – DavidPostill
    Nov 16, 2015 at 13:49
  • Nothing's wrong with these folders! /usr/bin and ~/bin are for binaries, not folders like SDK or office suite.
    – VivienG
    Nov 16, 2015 at 13:53

1 Answer 1

11

In linux, the general idea is that all software that is not isolated to a specific user account, should be installed and maintained by an administrator.

Software in /opt can be executed by the user however, so it has 755 permissions by default.

It is important that all executables on the PATH (except those of user scope) are administrator approved, to prevent common pathing exploits. Since software installed in /opt can affect all users, its locked down.

It is also a general rule in linux that all folders in / are owned by root:root. that prevents deletion and renaming. see here for more details and guidelines on the Linux directory structure: http://www.thegeekstuff.com/2010/09/linux-file-system-structure/

3
  • 2
    So can I install, Android Studio for example, in that folder as superuser without changing folder owner? Will I have problems because user launched app not be able to write on its folder?
    – VivienG
    Nov 16, 2015 at 13:57
  • 2
    Well, a correctly designed application will write all its config/temporary/output documents in ~/, to preserve user isolation. If the application does not conform to these standards, you can change the ownership/permissions on the /opt/AndroidStudio directory instead of on /opt itself. Nov 16, 2015 at 14:00
  • Ok, you perfectly answer my question, thank you very much!
    – VivienG
    Nov 16, 2015 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.