Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why is my homedir wide open?
2 points by read on May 12, 2013 | hide | past | favorite | 3 comments
Why does the default mode of adduser is to create a home directory that is wide open for anyone to change into?

I'm curious how that decision was made.



Unix started out at universities. Most students and teachers would have things they wanted to share with each other, and the filesystem was the most efficient way of doing so (remember this was well before the web, before even finger). So most users would have at least some public files, and since you only have one home dir this meant the home dir had to be public (it wouldn't make sense to put a public dir inside a private one - rather, you'd have a (or several) private subdirs for anything you wanted to keep private).

As for why it's still like that, it's just never been worth the cost of changing it. Since we now have forty years' worth of shell scripts etc. built on those semantics it would be pretty much impossible to change the default now. On a modern graphical linux most users aside from old unix diehards will use the system's UI with its own interface, so it's unlikely to cause problems for many people.

(To answer your literal question about "how the decision was made", most likely Kerrigan or Ritchie thought about it for a couple of seconds and then coded it that way. That's how most of unix's "design decisions" happened)


If you create a file in your home directory that you give permission to anyone to read or write to, having a+x on your home directory will actually allow them to read/write the file if they know the full path to it.

This behavior is useful on subdirs, too; for example, a shell account I used in the past had http://server.example.com/~username/ mapped to /home/username/public_html, and since the webserver ran under a user that didn't have root permissions, making /home/username a+x allowed the webserver user to access the files that I wanted to share over the web (assuming I had public_html chmodded properly, of course).

So it's less about cd and more about direct file and/or directory access for purposes of widely-accessible files.


This isn't the case on any of my machines. What kind of system are you on ?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: