- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: directory permission?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 02:00 PM
09-05-2003 02:00 PM
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 02:07 PM
09-05-2003 02:07 PM
Re: directory permission?
Yes, by granting write permissions, anyone can remove files in the directory. You can/should set the 'sticky' bit on the directory. This means that only the file's owner, or the directory's owner can remove the file:
# chmod 1777 subdir
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 02:28 PM
09-05-2003 02:28 PM
Re: directory permission?
You are seem not right on this.
I did a little test, I can't remove "subdir" if I'm not part of the group, even though the permission of "subdir" is 777, because the "maindir" is 770
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 02:37 PM
09-05-2003 02:37 PM
Re: directory permission?
Suppose that userA create a file /maindir/subdir/userA with permission 644.
Now if you want userB to be able to remove the file /maindir/subdir/user then make the permissions on subdir 777 BUT if you do not want someone other than userA to remove the file then you set the 'sticky' bit 1777.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 02:46 PM
09-05-2003 02:46 PM
Re: directory permission?
Setting the sticky bit on the directory prevents *files* in the directory that are not owned by the user attempting to remove them from being removed.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 05:03 PM
09-05-2003 05:03 PM
Re: directory permission?
I don't know if you don't understand what I described here, or I don't understand you two. I am sorry if it is later one.
I am only talking about the level of "maindir" and "subdir", /maindir/subdir, no third level of directories/files involved here.
Les's say the "maindir" is owned by userA:groupA, and the permission is "770". The "subdir" is also owned by userA:groupA, but permission is "777". So, in the citualtion like this, A user, say userB who is not part of groupA can't remove "subdir", even though it's permission is "777"! Am I right here?
My original question was, in this case as I desribed if there will be any dangerous for any subdirectories(with permission of 777) under "maindir"?
Thank you for your patient.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 05:18 PM
09-05-2003 05:18 PM
SolutionThere are two things here
1. If userB is not in the group as your maindir permissions, then userB cannot enter maindir. Removal of subdir comes next.
2. Also when it comes to directories, there is a slight change of rules here.
// Read the man page of rmdir Removal of a directory requires write and search
(execute) permission in its parent directory, but no permissions on
the directory itself; but if the sticky bit is set on the parent
directory, only the owner of the directory, the owner of the parent
directory, or a user having appropriate privileges can remove the
directory.//
So you may not be able to delete your subdir by above rules and your permissions. But if userB can enter into maindir then he/she can be able to delete files|dirs under subdir (though not subdir itself unless you gave full permissions to maindir), unless you setup sticky bit on it.
Hope it is clear to you.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 05:48 PM
09-05-2003 05:48 PM
Re: directory permission?
If maindir's permission is 770, that means users other than the dir owner or same group member cannot enter the maindir directory or see the content of maindir.
They cannot remove or see subdir even its permission is 777, you may see a permission denied error when you try to remove the subdir in this case:
rm: cannot stat maindir/subdir: Permission denied
Hope it helps.
twang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 06:48 PM
09-05-2003 06:48 PM
Re: directory permission?
We are talking now...
So, in another words, as long as I have permission 770 on maindir, I don't need to worry anybody else(other than root) being able to remove it's sub directories/files, even though these sub directores/files has permission of 777 on them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 07:10 PM
09-05-2003 07:10 PM
Re: directory permission?
Well you still have to worry about the people in the group. Because they can do anything beneath maindir to the owner's files/directories. So, it is better to configure subdir with sticky bit. It doesn't hurt to keep sticky bit on that directory.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 07:30 PM
09-05-2003 07:30 PM
Re: directory permission?
logon system as user a,
a@rhost$ mkdir maindir
a@rhost$ chmod 770 maindir
a@rhost$ ll
total 0
drwxrwx--- 2 a dba 96 Sep 6 11:28 maindir
a@rhost$ cd maindir
a@rhost$ mkdir subdir
a@rhost$ chmod 777 subdir
a@rhost$ ll
total 0
drwxrwxrwx 2 ora dba 96 Sep 6 11:29 subdir
logon system as another user b,
$ cd /home/a
$ ls
maindir
$ ll
total 0
drwxrwx--- 3 ora dba 96 Sep 6 11:29 maindir
$ cd maindir
sh: maindir: Permission denied.
$ rm -r maindir/subdir
rm: cannot stat maindir/subdir: Permission denied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 07:35 PM
09-05-2003 07:35 PM
Re: directory permission?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 07:51 PM
09-05-2003 07:51 PM
Re: directory permission?
However, if there is a user userC belongs to dba group, he/she can happily enter maindir directory and delete subdir as well the files under subdir. So protect maindir and subdir with sticky bit.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2003 08:15 PM
09-05-2003 08:15 PM
Re: directory permission?
Completely agree with you! TO further protect subdir, we must set sticky bit.