- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: default create perms on files for everyone
Operating System - Linux
1753261
Members
4958
Online
108792
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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-09-2010 05:21 AM
тАО09-09-2010 05:21 AM
Hi All,
What I'm trying to do is set my Red Hat 5.5 server so that any file created in a certain directory (by any user) is readable and writable by any other user.
This directory is a temp directory that is used very often to move files between users and our ERP system, and needs to be as wide open as possible. I realize a chmod command can do this, but there are thousands of files in here throughout the day, so that's not really a feasible solution.
Is this something that an ACL could be used for? Basically, anything created in /usr/tmp needs to be readable and writable by everyone at all times.
Hopefully that is enough info! Seems like it should be easy enough to do, but after days of googling and testing, I haven't figured it out. :)
Thanks,
Jason
What I'm trying to do is set my Red Hat 5.5 server so that any file created in a certain directory (by any user) is readable and writable by any other user.
This directory is a temp directory that is used very often to move files between users and our ERP system, and needs to be as wide open as possible. I realize a chmod command can do this, but there are thousands of files in here throughout the day, so that's not really a feasible solution.
Is this something that an ACL could be used for? Basically, anything created in /usr/tmp needs to be readable and writable by everyone at all times.
Hopefully that is enough info! Seems like it should be easy enough to do, but after days of googling and testing, I haven't figured it out. :)
Thanks,
Jason
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2010 06:42 AM
тАО09-09-2010 06:42 AM
Solution
> any file created in a certain directory (by any user) is readable and writable by any other user.
I see why you're thinking "world writable" as a possible solution, but I'd recommend you to approach this problem in a different way.
Your ERP system is probably running on some particular user account.
1.) Create a group using any name you want. For example, "tempdir":
groupadd -g 999 tempdir
(Choose the group ID so that it won't interfere with any normal user accounts.)
2.) Then add the ERP system account and all the human users on the system to that group. Since users can belong to multiple groups simultaneously, this should not be a problem.
(You don't need to change the users' _primary_ group: this can and probably should be a secondary group.)
gpasswd -a erpuser tempdir
gpasswd -a user1 tempdir
gpasswd -a user2 tempdir
...
Note: while "usermod -G tempdir" would achieve much the same thing, the "gpasswd" command will automatically _add_ the new group to the user's current group memberships. With "usermod -G", you would have to check the user's current group memberships and explicitly list all the secondary groups you would want for the user.
3.) Restart the ERP system, so that all its processes will be aware of the new group membership.
4.) Set the group of the temporary directory to "tempdir", and permissions to 2775 (drwxrwsr-x):
chgrp tempdir /usr/tmp
chmod 2775 /usr/tmp
This enables the "setgid" feature on the temporary directory (unless it's prevented by filesystem mount options). Now all the files created to this directory will get "tempdir" as the group owner automatically. All sub-directories created will automatically inherit both the group owner and the setgid feature.
Since now both the ERP system and the users will belong to the "tempdir" group, having the directory and the files group writable will be sufficient: no world-writability is required.
System daemons that are unrelated to the ERP system and are running on a specific account of their own will still be prevented from writing to the directory (or from accessing it at all if you want), which is good security.
5.) Make sure the users' umask allows group write permissions (this might be correct by default?)
If you want users' files to be world-readable by default, add "umask 002" to the end of users' login scripts. If that's too much, you might use "umask 007" instead.
(This might even be unnecessary, if the ERP system only needs to read & delete user-created files, and write its own files: remember that file deletion is not controlled by the write permission on the file itself, but by the write permission on the _directory the file's in_.)
-------------
Now, if user1 creates a non-executable file in anywhere other than the special directory, the file permissions & ownerships will be:
-rw-rw-r-- user1 user1 ...
Since the default group "user1" contains only user "user1", the group-writeability won't cause any harm.
In the special directory, the permissions & ownerships will be:
-rw-rw-r-- user1 tempdir ...
Since the ERP system will be a member of the tempdir group, it can write to the file. Because the directory is also writable by the tempdir group, the ERP system can delete any file in the directory.
MK
I see why you're thinking "world writable" as a possible solution, but I'd recommend you to approach this problem in a different way.
Your ERP system is probably running on some particular user account.
1.) Create a group using any name you want. For example, "tempdir":
groupadd -g 999 tempdir
(Choose the group ID so that it won't interfere with any normal user accounts.)
2.) Then add the ERP system account and all the human users on the system to that group. Since users can belong to multiple groups simultaneously, this should not be a problem.
(You don't need to change the users' _primary_ group: this can and probably should be a secondary group.)
gpasswd -a erpuser tempdir
gpasswd -a user1 tempdir
gpasswd -a user2 tempdir
...
Note: while "usermod -G tempdir
3.) Restart the ERP system, so that all its processes will be aware of the new group membership.
4.) Set the group of the temporary directory to "tempdir", and permissions to 2775 (drwxrwsr-x):
chgrp tempdir /usr/tmp
chmod 2775 /usr/tmp
This enables the "setgid" feature on the temporary directory (unless it's prevented by filesystem mount options). Now all the files created to this directory will get "tempdir" as the group owner automatically. All sub-directories created will automatically inherit both the group owner and the setgid feature.
Since now both the ERP system and the users will belong to the "tempdir" group, having the directory and the files group writable will be sufficient: no world-writability is required.
System daemons that are unrelated to the ERP system and are running on a specific account of their own will still be prevented from writing to the directory (or from accessing it at all if you want), which is good security.
5.) Make sure the users' umask allows group write permissions (this might be correct by default?)
If you want users' files to be world-readable by default, add "umask 002" to the end of users' login scripts. If that's too much, you might use "umask 007" instead.
(This might even be unnecessary, if the ERP system only needs to read & delete user-created files, and write its own files: remember that file deletion is not controlled by the write permission on the file itself, but by the write permission on the _directory the file's in_.)
-------------
Now, if user1 creates a non-executable file in anywhere other than the special directory, the file permissions & ownerships will be:
-rw-rw-r-- user1 user1 ...
Since the default group "user1" contains only user "user1", the group-writeability won't cause any harm.
In the special directory, the permissions & ownerships will be:
-rw-rw-r-- user1 tempdir ...
Since the ERP system will be a member of the tempdir group, it can write to the file. Because the directory is also writable by the tempdir group, the ERP system can delete any file in the directory.
MK
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2010 06:57 AM
тАО09-09-2010 06:57 AM
Re: default create perms on files for everyone
Thanks Matti,
I hadn't actually thought about using groups and setting the guid bit on the directory.
For some reason, I was hoping that there would be a way to set the ACL on the directory to give worldwide read/write perms to every file in it, regardless of how it was created (ftp, samba, shell, etc).
Unless I hear something else in the meantime, I will give your idea a try when I get a chance for a bounce of the ERP.
Thanks again for all the info!
Jason
I hadn't actually thought about using groups and setting the guid bit on the directory.
For some reason, I was hoping that there would be a way to set the ACL on the directory to give worldwide read/write perms to every file in it, regardless of how it was created (ftp, samba, shell, etc).
Unless I hear something else in the meantime, I will give your idea a try when I get a chance for a bounce of the ERP.
Thanks again for all the info!
Jason
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP