Search

Difference Between Home & Root Directories?

  • Thread starter LukeLewis
  • Start date
LukeLewis

LukeLewis

Member
Joined
May 7, 2021
Messages
134
Reaction Score
0
Points
21
  • #1
I am no Linux or server administrator and that may explain why I'm having such a a tough time with this. I was talking to an employee of my website hosting company the other day when they told me that I can store a file in my root directory. Then another guy told me I can store the same file in my home directory. I asked them which directory this was and if they were both the same and their explanation left me more confused than I was before I asked them the question. I am left with no idea of which directories these are and I can't seem to find a straight answer online.

So I ask you; what's the difference between the home directory and the root directory on a website hosting server? Does anyone know?
 
Phoenix1

Phoenix1

Member
Joined
May 7, 2021
Messages
135
Reaction Score
0
Points
23
  • #2
As far as which directory is in which location in relation to one another, this is the best descriptions I've seen to date:

The root directory is the entrance hall to your house. Your home directory is your bedroom. Everyone can go into their own bedrooms, but only you can go into your bedroom.

So basically, according this the above, the root directory contains all user accounts within an operating system. Those user accounts have home directories that are sectioned off based on users.

I think your confusion stems from the fact that the word "root" is used haphazardly when referencing places in operating systems. For instance, take a look at another description of what a home directory and a root directory is:

The simple answer is that the “home directory” is the head or “root” of the naming tree of where a specific user places her/his files and is traditionally the directory that the OS places you when you login and forks your shell. The term “root directory” is the name of the head of the entire hierarchical namespace for any UNIX based system.

Do you see how they say the home directory is the root of a user account? Right there - that's what's confusing to a lot of people. People out there should be more specific when using the term "root." For us non-admin types, our heads get bent out of shape.

If you're a server admin, you'll have access to everything on that server, root directory included. You'll also have access to all user home and user directories. If you're just a user who rents out a piece of a server though, like those who use shared hosting accounts, you won't have access to the root directory. You'll only have access to your own home directory.

Here's what Wikipedia says about these directories:

A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory (such as its name and location) are defined by the operating system involved; for example, Linux / BSD (FHS) systems use /home/<username> and Windows systems between 2000 and Server 2003 keep home directories in a folder called Documents and Settings.

To make things easier to remember, just think about the fact that users can go home. That's where all their stuff is. It's the folder that's theirs. Admins can go anywhere, including someone's home. They own the lay of the land. Other users can't go to someone else's home and all users can't go to the root. Take a look:

/root/home/user/

Users are allowed where it's bold.

/root/home/user/

Server and system admins are allowed where it's bold.

/root/home/user/

Of course, the directory structure above is only meant for illustration purposes to help the novice understand which directory is which.

Does anyone else have anything to add? I'd love to see some more technical insight down below.
 
W

wick3dr0se

New Member
Joined
Jun 12, 2021
Messages
1
Reaction Score
2
Points
3
  • #3
LukeLewis said:
I am no Linux or server administrator and that may explain why I'm having such a a tough time with this. I was talking to an employee of my website hosting company the other day when they told me that I can store a file in my root directory. Then another guy told me I can store the same file in my home directory. I asked them which directory this was and if they were both the same and their explanation left me more confused than I was before I asked them the question. I am left with no idea of which directories these are and I can't seem to find a straight answer online.

So I ask you; what's the difference between the home directory and the root directory on a website hosting server? Does anyone know?
Your home folder is where your users and ultimately your user content resides like your configs, dotfiles, downloads, and your personal files. The root(/) folder is where your system stores kernels, boot images, packages and many other important files. This should be considered a protected folder that holds your very important system components. The root(/) directory should not be confused with the /root user directory, which is your root user's content folder. Just as the users in your home directory. To make any changes to files in the root(/) directory would require superuser privileges or elevating oneself to mentioned root user. Using the home directory is always the preferred method unless you want to change something system-wide and not per user. Linux is meant to be operated on a user level to protect your system; unlike Windows.
 
Last edited:
  • Like
Reactions: Phoenix1 and JGaulard
Top