Solved

default user id for any file created in a certain directory

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

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…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

816 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

8 Experts available now in Live!

Get 1:1 Help Now