ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Linux: Home Directories

    IT Discussion
    unix linux sam linux administration
    2
    2
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      In an earlier lesson, we talked about the standard filesystem hierarchy in Linux. One of those standard directories is the /home directory: the directory where users keep their own files. (Good to note that the /home directory concept is universal to UNIX systems and many others, but the specific name /home is a Linux-ism.)

      On Linux, each user (except for root) by default gets a home directory with their own name under /home. That means if you have three users; john, mary and student; that you would have three home directories for them: /home/john, /home/mary and /home/student.

      It must be noted that there is no actual necessity for an account to have an existing home directory. You can easily create a user that has no home directory. But for practical purposes, we assume that they always have one. Many utility accounts may not.

      The /home directory and the use of the username as the name of the directory itself are conventions and not enforced. It is completely possible to modify this system. Although it is rarely recommended to do so. Conventions are important for many reason.

      The assigned home directory of a user is defined in the /etc/passwd file as we saw before If we look at a line from a passwd file:

      scott:x:501:501:Scott Alan Miller:/home/scott:/bin/bash
      

      The sixth field (the line is colon delimited) is the assigned home directory. You can modify this as needed, but it would be pretty rare that you would want to do this.

      UNIX Conventions: It is very common for home directories on UNIX systems to either me mounted remotely from a central storage system (more on that much later) or to be on its own independent file system. Of course it is also common to just be a part of the main filesystem.


      The current user's home directory can also be referenced by the tilde "~". This is very handy in commands and is most commonly seen with the cd command to return a user directly to their own home directory:

      cd ~
      

      You can use this tilde notation in any path such as:

      cat ~/lists/groceries.txt
      

      The Linux approach to the home directory makes it very discrete and easy to work with. This central and strict location of files makes security, backups and remote use of files exceptionally powerful.

      1 Reply Last reply Reply Quote 4
      • ObsolesceO
        Obsolesce
        last edited by Obsolesce

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post