1

I am a beginner here at unix administration. When we create a Unix user, we get a home directory for the user. Inside the home directory i.e ~/ for all the files and directories that we create, what is the use of setting the file permissions? As what I understand is the owner will always be the user and the home directory purpose is to isolate the files and directories for that user.

So, when no other user except the root can log in to the user's home directory, what is the user to give the group permissions for the files inside the home directory for the user. Am I missing something here?

1 Answer 1

2

You're missing collaboration. You wrote, "the home directory purpose is to isolate the files and directories for that user". This could be better written by replacing the word "isolate" with the word "contain".

Suppose I've written some useful utility programs. I've put them in my ~/bin directory (I'm old school). I can choose to make that directory and its contents publicly accessible to other users of the system, without necessarily making any of my other files and directories accessible. If other users trust me enough they can add that directory to their PATH, or alternatively copy its contents to their own directory.

chmod a+x ~                 # Allow access to my directory without being able to list its contents
chmod a=rx ~/bin ~/bin/*    # Allow anyone to read or execute my programs
4
  • For the files that needs to be shared, it makes sense. Does it also mean that, no other user can navigate to the home directory of another user apart from the root user.
    – zilcuanu
    May 7, 2021 at 8:25
  • You can navigate to it but not see its contents. For example cd /tmp/secret might work but then ls could return ls: cannot open directory '.': Permission denied May 7, 2021 at 8:29
  • Create a couple of throwaway accounts on a dev/test system somewhere and experiment May 7, 2021 at 8:29
  • I am trying in a test server. I created two users adam and bob. I tried cd /home/bob with root privileges. Inside the /home/bob when I try to do a su - adam I get logged out and navigate to /home/adam directory.
    – zilcuanu
    May 7, 2021 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .