In Linux, why isn't superuser root's folder under /home?

6,490

Solution 1

One reason: On many systems, /home is on a separate partition (or network share) that might fail to mount and it is a good idea to allow root to login with his usual environment whenever possible.

Solution 2

root's home should be on the partition that the operating system resides on, which by definition is /, so that you can still login as root without issues if, say, another disk partitions are unavailable. /home is sometimes mounted on a separate partition or a separate drive. If this contains the root homedir and is offline, you may encounter difficulties with your login shell. Not a good idea if you're trying to fix things as the root user.

Share:
6,490
tacos_tacos_tacos
Author by

tacos_tacos_tacos

Updated on September 18, 2022

Comments

  • tacos_tacos_tacos
    tacos_tacos_tacos over 1 year

    You can create a user that has privileges like root, and it's home directory will fall under /home/username. Why does root get its own folder at the top level of the file system? Is this just convention, a security concern, or is there a performance-related reason?

    • Admin
      Admin almost 12 years
      Note that the root user and "admin" users are not normally the same thing at all. An "admin" user (assuming this is what you mean by "privileges like root") is typically just a regular user that is permitted to execute commands as root using something like sudo.
  • Hennes
    Hennes almost 12 years
    This is the same reason why most unix systems have /sbin, /sbin and a /usr/bin and /usr/sbin. The first two contain essential binaries to bring the system up and are therefor located on the root filesystem.
  • tacos_tacos_tacos
    tacos_tacos_tacos almost 12 years
    @Hennes you repeated /sbin twice what did you mean to say?
  • Izkata
    Izkata almost 12 years
    @jshin47 Same as the second part, without /usr/, I would guess. /bin/ and /sbin/.
  • José Rios
    José Rios almost 12 years
    There is a very good discussion at lists.busybox.net/pipermail/busybox/2010-December/074114.htm‌​l. I think it may have started as a unique user system (the root user) and after some improvements (don't know if Unix refers to unique user of some sort) it may have been necessary to add different users with different configurations that need to reside on some other directory. Just guessing.
  • tacos_tacos_tacos
    tacos_tacos_tacos almost 12 years
    @licorna is the poster in the link you provided questioning the continued necessity of the separation or just saying that it is an artifact that was first continued by convention but is still useful today?
  • Brian
    Brian almost 12 years
    +1 you always want root's home directory on the boot partition in case of horrible events. The same reason that in traditional unix assigned root's shell by default to a statically linked POSIX shell - don't rely on things that may not be there...
  • José Rios
    José Rios almost 12 years
    @jshin47 the poster in that link is not questioning, but detailing historical circumstances that led to the current state.
  • Bart van Heukelom
    Bart van Heukelom almost 12 years
    It won't help you though if logging in as root is not possible (e.g. default in Ubuntu), so you'd have to make that possible to benefit from this.
  • Alberto
    Alberto almost 12 years
    Uhmmm, I don't buy it: If things go wrong, I don't care about my root profile. I can live with standard config just during recovery. Furthermore, I also think @BartvanHeukelom has a point. Am I missing something? I'm not a linux expert, but I have checked three of my boxes (Gentoo, Debian, SLES), and all three have only profile stuff in /root.
  • FooBee
    FooBee almost 12 years
    @Alberto: Unix is ancient and the recovery abilities of modern systems couldn't even be imagined back in the days. There are many things in a Unix-like system that would certainly be handled differently from todays perspective. Also, what you put into your root folder is entirely up to you.
  • Alberto
    Alberto almost 12 years
    @SvenW Thanks. I see. So it's a combination of history and convenience, but not a must. I would upvote if you could name one or more examples of what an admin would store in /root nowadays... (Perhaps I have to review my habits!)
  • FooBee
    FooBee almost 12 years
    @Alberto: I don't think there is a best practice and if you are happy the way you work, it's all good. I tend to drop tarballs and rpm/deb files local to a system into this and most important (but luckily nearly ever used) a copy of my config doc tree. This can come handy if I have console access to a machine but the network is down for whatever reason.