Solved

default user id for any file created in a certain directory

Posted on 2004-04-26
5
284 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 150 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
digital ocean web console access ? does it use port 22 4 57
linux 13 109
How to change the nameserver on Ubuntu Server 6 78
database connection error mysql stops 7 32
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

726 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