Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several programs I want to download their src files and compile. They are fetched through git, so I can easily pull updates and recompile them. The right location of these files, to my understanding, is /usr/local/src.

But aren't some (most? any?) deter the use of sudo for source compilation aside make install? So should I give /usr/local/src user permissions? Or am I completely mistaking?

share|improve this question
I just put source code in my home directory, as in /home/<username>/Code/... – Ash May 13 '13 at 22:45
I thought about doing that, but take tig for example - it only have make, and not make install. I manually add the binary to /usr/local/bin. Placing it in my home folder would mean it's only accessible to me. XnView is another example, without any compilation at all. – CrimsonKing May 13 '13 at 23:11
Ah, okay sounds like you're building tools/modules to run on your system, as opposed to just "developing software"? Maybe putting it in /usr/local is better than, but your instinct about having to "sudo" everything is correct -- it's not recommended. – Ash May 14 '13 at 0:51

The configure and make portion of the process should be performed without escalated privilege. Once that is successfully completed, the install is performed with superuser role (i.e. sudo). Commonly, storage of source is within your $HOME and compilation performed there. I'd strongly recommend packaging the project for integration into your system(s) via native package management.

To answer: no, don't change the permissions of '/usr/local/src' ; just utilize your $HOME for building.

share|improve this answer
Though I wonder - if I do give privileges to make install, what difference does it make to give privileges to configure and make? – CrimsonKing May 14 '13 at 18:14
Privilege escalation should only be invoked when absolutely necessary. It's not needed during configure and make portion of the build (the binaries are created after these are successfully completed usually). The install phase requires modification of the fs and linking, etc. which require privilege escalation. – swa Aug 6 '13 at 5:01

There is no such thing as the "correct location" it is up to the admin to decide. True, traditionally Linux admins place source files in /usr/local/src and you are free to do so. You can also place them in your $HOME, whatever you prefer.

Now, if you are compiling/installing software you are the admin. Therefore, there is no reason why you should not switch to root in order to have access to /usr/local/src. There is absolutely no reason why you should not compile as root, that is what every sysadmin I have ever known does, that is why the root user exists, to perform administrative tasks. This includes the compilation and installation of software.

So, if you are developing software, do it in your $HOME, if you are installing other people's software from source, do it as root in /usr/local/src if you so desire. Personally, I compile programs in $HOME/Setups because my $HOME is on a separate partition and that makes it easier for me to upgrade/reinstall my system. That is just a personal choice though and proper sysadmins will compile in /usr/local/src as root.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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