Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

default user id for any file created in a certain directory

Posted on 2004-04-26
5
Medium Priority
?
288 Views
Last Modified: 2013-12-15
I understand that using the root account may be convenient but not a good idea in the long run.  I have a whole bunch of directories that should be edited by user A but sometimes they are edited by root.  Is there a way to make any new file/edited file in a certain folder be owned by user A regardless if root or any other user is the one creating it.  I've tried setting the uid and gid permissions but this does not work (at least with the root user).  Changing the umask will not help the issue due to security concerns.  Any suggestions?
0
Comment
Question by:bisonfur37
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 2

Author Comment

by:bisonfur37
ID: 10921099
By the way, I am using RedHat 9.
0
 
LVL 2

Author Comment

by:bisonfur37
ID: 10921263
I decided to try all of my possibilites and found something interesting.  Note that I am working as the root user and the Backup directory is inside the home directory of 'personA'.  If I do
chmod -R 4755 Backup
and decide to create a new file inside the Backup directory, the new file will still be owned by user and group root

However, if I do
chmod -R 2755 Backup
and decide to create a new file inside the Backup directory, the new file will be owned by user root and group 'personA.'

This is half the battle since a umask change of the directory will do the trick.  Does anyone know why the first command does not work with root?  As a matter of fact, does anyone have a good resource for permissions handling with situations like mine?  Thanks
0
 
LVL 2

Author Comment

by:bisonfur37
ID: 10921371
I have set the umask in 'personA' .bash_profile file and all works now.  I have one more question in addition to the one above.  Is this setting of umask only available per user home directories or can each directory have its own umask?  It seems that XFS is the only file system versatile enough to do this.  Is this true?  Any thorough and complete references in the matter?  Thanx.
0
 
LVL 5

Accepted Solution

by:
willy134 earned 300 total points
ID: 10940567
chown will change the owner of a file

There is also chmod+s which is a sticky bit which usually keeps the files in a folder associated with that owner.  The chmod is ran on the folder.

I don't have a root account on the machine I am working on right now so you will have to give it a shot.

umask is a  per user command so if umask is set it will always (irregardless of workign dir) set that umask
0
 
LVL 2

Author Comment

by:bisonfur37
ID: 11606184
So it seems that by setting the permissions to 'chmod -R 2755 <dir>' we are beginning to get the right behaviour.  If we set the umask to 002 in .bash_profile for this user (personA) we are almost there although any file created by root is still not group writeable.  At the moment I cannot continue testing because I have another user PersonB, whom I made a group member of PersonA's group (usermod -G PersonA PersonB), however PersonB cannot get into any of PersonA's directories.  Any help?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question