Solved

default user id for any file created in a certain directory

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

691 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