Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
I read about sticky bits from several sources, and they all say that when the sticky bit is set on a directory, then any files in that directory can only ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85

    Cool why doesn't the home directory have the sticky bit set?


    I read about sticky bits from several sources, and they all say that when the sticky bit is set on a directory, then any files in that directory can only be deleted by the owner of the file, and not the owner of that folder. My questions are: why is it that the sticky bit is not set on the home directory? Also, why the heck doesn't it do that by default when other people are allowed to write to it? Why on Earth would I want the default?

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    On my Fedora setup, only I can enter and write files in my /home/userid directory (Fedora uses private groups for users), so there is no need to set the sticky bit. The sticky bit in my opinion is best where many people write files to a shared directory and you only want the owner of the files to be able to delete them.

  3. #3
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85
    no when I said home directory I meant "/home" which was kind of implied when I said "THE home directory"

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,701
    Generally, /home should only be writable by root, not by any user. When you create a new user account, and the user directory is created in /home, the root user that creates the account will change the user/group to the user created, and make the directory only readable/writable by that user. Again, no sticky bit required.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #5
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85
    wouldn't the permissions from the /home directory affect the /home/user directory?

  7. #6
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    Not necessarily.
    The /home directory can have one set of permissions, while it's child directory (/home/user) has another set.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  8. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,701
    Quote Originally Posted by rm-rf View Post
    wouldn't the permissions from the /home directory affect the /home/user directory?
    Generally not. /home should be read-only for all but root. Only root can create a new user account, and root has full permissions on /home, so it can create the user directory, and then change the ownership of that directory to the new user. This is part of the fundamental security of Unix and Linux systems, effectively sandboxing users from munging with other users' data without permission, which that other user can grant if appropriate.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #8
    Just Joined!
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    41
    Why isn't the sticky bit always turned on?
    Sure, it is unnecessary in most cases, but it never causes any problems either. Forgetting it on directories where many users have write access has the effect that write protecting files is meaningless, because anyone can delete the file and replace it with a modified copy. I can't think of a single situation where this possibility would be desirable, so why is it even possible to turn off the sticky bit?

  10. #9
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85
    Quote Originally Posted by kohog View Post
    Why isn't the sticky bit always turned on?
    Sure, it is unnecessary in most cases, but it never causes any problems either. Forgetting it on directories where many users have write access has the effect that write protecting files is meaningless, because anyone can delete the file and replace it with a modified copy. I can't think of a single situation where this possibility would be desirable, so why is it even possible to turn off the sticky bit?
    that is exactly what I thought when I first heard about it. What's the point in having having file permissions if non-sticky directories override them?

  11. #10
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    Let's say that a group has 3 members (Joe, Sam and Sue), all working on a project together.
    Perhaps they are working on 3 different aspects of it. You could set the sticky bits on the files for each of them so that they can't be modified by the other members of the group, but can be read by them.
    Joe wants to let Sam and Sue see how far he has gotten on his part of the project, so they take a look.
    He can feel safe doing so because there is no chance of accidental modification or deletion of the document.

    Just one example.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •