shadedecho
Programmer
This is a Debian/GNU linux machine, so here's my situation:
I have a /home directory, under which all local users of my system have their own directories.
So, I have a user named John, and so his directory is /home/john.
I set the permissions on the users directory to 2755, so that all files/directories created by the user inside of their own directory automatically inherit the same "group" as their parent.
the user "john" is obviously the owner of the /home/john directory.
Now, what I want is to be able to place a directory inside of John's directory, like /home/john/test, which he can see, access, and read, but NOT write into. Easy enough, simply make the owner (and group) of that "test" directory root, and make the permissions 755 for that directory.
Here's the tricky part. Is there anyway to prevent "john" from being able to rmdir the "test" directory, or mv to rename it?
I would have thought withholding the "write" permission for a directory would prevent it from being deleted or renamed, but apparently the "write" only applies to the contents of the directory.
Obviously, john has got to be the owner of /home/john, so i can't use the sticky bit option on his home directory (since it only denies non-parent-directory owners rename/delete permissions). john also has to be able to write other files in his directory, so i can't simply remove the "write" permission from /home/john.
So, is there any other way to do this?
***********************************************
If I create a "blah" directory, root:root in /home/john, and set its permissions to 1755, and then inside of "blah", put "test", like /home/john/blah/test, then john cannot delete/rename "test". He also cannot delete "blah", even with "rm -rf", because that would be removing test, which he has no permissions to do. But, he can still rename "blah", so it kinda defeats my purpose of sticking a directory in there that is completely read-only. This is a closer option, but still not completely safe for what I want.
How come root can't stick a file or directory somewhere (anywhere in the filesystem) that a non-root user can only read or access, but not delete or modify? Am I missing something? I thought root would be all powerful like this.
I have a /home directory, under which all local users of my system have their own directories.
So, I have a user named John, and so his directory is /home/john.
I set the permissions on the users directory to 2755, so that all files/directories created by the user inside of their own directory automatically inherit the same "group" as their parent.
the user "john" is obviously the owner of the /home/john directory.
Now, what I want is to be able to place a directory inside of John's directory, like /home/john/test, which he can see, access, and read, but NOT write into. Easy enough, simply make the owner (and group) of that "test" directory root, and make the permissions 755 for that directory.
Here's the tricky part. Is there anyway to prevent "john" from being able to rmdir the "test" directory, or mv to rename it?
I would have thought withholding the "write" permission for a directory would prevent it from being deleted or renamed, but apparently the "write" only applies to the contents of the directory.
Obviously, john has got to be the owner of /home/john, so i can't use the sticky bit option on his home directory (since it only denies non-parent-directory owners rename/delete permissions). john also has to be able to write other files in his directory, so i can't simply remove the "write" permission from /home/john.
So, is there any other way to do this?
***********************************************
If I create a "blah" directory, root:root in /home/john, and set its permissions to 1755, and then inside of "blah", put "test", like /home/john/blah/test, then john cannot delete/rename "test". He also cannot delete "blah", even with "rm -rf", because that would be removing test, which he has no permissions to do. But, he can still rename "blah", so it kinda defeats my purpose of sticking a directory in there that is completely read-only. This is a closer option, but still not completely safe for what I want.
How come root can't stick a file or directory somewhere (anywhere in the filesystem) that a non-root user can only read or access, but not delete or modify? Am I missing something? I thought root would be all powerful like this.