I am new to the world of Linux and am about to make a complete transition from Windows to Linux so I can really get into it. I understand that Linux has a hierarchical structure however am unclear about the following;

  • Currently for example I have 2 partitions on my Windows machine i.e. C:\ and D:. C:\ is the boot partition but also the partition where all software is installed e.g. Office, Firefox, etc. D:\ is used to store data such as documents, images, etc. Essentially D:\ store any data of value. Now if my understanding is right in Linux the usr directory would store all my applications. My home directory stores all my data files. Is that correct?
  • Assuming if that is correct and I am logged in as a non-root user, I take it I can install software that does not require root permissions. If so, can I choose a directory other than usr to install the software?
  • Can I create directories outside of home as a non-root user or am I restricted to just the home directory? I know this depends on the permissions of the user however if I am looking at a user created in a vanilla installation of Linux how would this differ?
  • What other directories are used by non-root users?
  • Assuming I have Apache installed on the PC, does this mean a non-root user would have to be given permissions to access, update and delete to the var/www. This is a workstation that will be used by several people.

3 Answers 3

  1. Mostly. Read the FHS for the full story.

  2. Distro packages usually require root permission to be installed. Software installed from source or that comes with its own installer can usually be installed in a user's home directory.

  3. It all depends on ownership and permissions, but not of the user per se.

  4. /tmp, as well as anything that has had its ownership and permissions appropriately set.

  5. No. See 3 and 4 above.

  • +1 for FHS as the full story
    – dmourati
    May 18, 2011 at 19:27
  • See below for my example for installing Apache as a non-root user. Is this possible? Will it be installed in the user's home directory? I understand it has to do with permissions but assuming I don't change any permissions and use the permissions set during the installation of the distribution, what does this entitle me to as a user? May 18, 2011 at 19:51
  • You can install it and configure it, but 1) it must subsequently be run as that user, and 2) it cannot listen on ports lower than 1024 so you will need to proxy from your main httpd install if you want it to appear on port 80. May 18, 2011 at 20:21
  • Correct. /usr and /opt tend to store all your applications, and /home/username tends to store all your documents and user data. There are edge-case exceptions to this, but it's mostly true.
  • If you're manually installing, you'll likely have to install it to a directory in your /home folder. You generally cannot install distribution packages through apt-get, yum, etc without root privileges.
  • Without being granted explicit permissions, no.
  • /tmp is accessible and used much like temp folders in Windows. All the other folders are used as a non-root user, just not generally written to.
  • To make changes to the /var/www directory, you'll have to join the users to a group that has permissions to it. Take a look at the bottom of this page for an example of this: http://cse.csusb.edu/turner/centos/apache.php
  • When you say edge-case exceptions, what do you mean by that exactly? Also you use the term generally when installing distribution packages, does this mean that it still can be done? If so when? Now assuming I download Apache from the web as a non-root user, would I still be able to install it, configure it, etc? I assume no. May 18, 2011 at 19:48
  • I say that because there is probably a distribution somewhere that has it hacked up to allow it, but all the ones that I know of don't. As far as installing Apache, you'll definitely need root privileges.
    – Hyppy
    May 18, 2011 at 19:56
  • Thanks. So if I wanted to set up some sort of backup policy for all the users on the PC, all I need to do is backup the home directory as well as any other directories I may have given permissions for? May 18, 2011 at 20:03

A non-root vanilla user can access:

  • /home/$USER #persistent
  • /tmp #volatile
  • /var/tmp #persistent

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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