Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing primary group within a script. 1

Status
Not open for further replies.

exsnafu

Technical User
Apr 25, 2008
99
0
0
US
I have a user who needs to change which group files get written out as several times within a script.

at first we looked at using setgroups and newgrp but those spawn a new shell and thus break the script.

i know at the end of the day we can just do a chgrp as a second operation for whatever files are being written but i'm wondering if there is some clever way to make this work in aix? on solaris i can use here docs with newgrp but seems the aix version isn't as accommodating.

 
As a work around what about using a sudo command running as a different user that you can create with the correct group.

Just a suggestion.
 
If there's a mapping between the file group name and the directory it ends up in then use the suid bit on the directory.

For example
Code:
mkdir -m2777 test_dir
chown user:test_grp test_dir
Any files created in test_dir will have test_grp group ownership.

On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top