Solved

default user id for any file created in a certain directory

Posted on 2004-04-26
5
280 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
  • 4
5 Comments
 
LVL 2

Author Comment

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

Author Comment

by:bisonfur37
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now