LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-08-2010, 03:10 PM   #1
sharky
Member
 
Registered: Oct 2002
Posts: 569

Rep: Reputation: 84
Change group in working environment


I have files that are sourced when users are working on a project. The files set environment variables and cd to the correct working directory and automate a few other things for the end users.

One thing I have not been able to figure out is how to change the user to a different group. Files created in a project context should have the project GID instead of the users default GID. I tried the newgroup command but it starts a new shell and breaks the other automation.

Any ideas on how this can be setup?
 
Old 09-08-2010, 03:40 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If the user is being sent to a different directory for that specific project you can put SGID on that directory and make the directory group the one you want. Any subsequent file placed in that directory will get the group of the directory itself. You can add the SGID bit with the chmod command (e.g. chmod 2770 <directory> gives owner and group read, write and execute and the 2 at the front sets the SGID).

What we do here instead of that is give all users their own login then make them "sudo su - <admin> to the admin user for the environment they want. From that point on all there work is owned by that admin user so group isn't an issue.
 
Old 09-08-2010, 05:01 PM   #3
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
MensaWater, Your suggestion works like a charm. Thanks for the tip.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Set environment variable by group mhouston100 Linux - Server 7 07-13-2010 12:12 AM
Secondary group users need to change the file permissions of primary group files? sunnybmv Linux - Newbie 3 12-10-2009 04:57 PM
root environment variables/group not set bratieres SUSE / openSUSE 1 11-22-2006 07:14 AM
environment change CloudBuilder Linux - Software 2 08-23-2005 01:03 PM
change group blackzone Linux - Newbie 3 12-14-2004 04:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration