473,396 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do you change a user's primary group as they change directory

1
User1 is a member of Group1, Group2 and Group3, each group has a directory (say /home/group1, /home/group2, ...)

How do I make it so that when User1 cds to /home/group1, their primary group becomes group1, when they cd to group2 they become group2, etc?

Essentially, I'm only looking to do this so that when User1 makes a new file in each respective directory, it can be set group writable for the appropriate group.

I will be doing this on Solaris 10 (Although I am testing on Ubuntu 8.10...)

Thanks!
Feb 4 '09 #1
4 5150
I suggest that u set up a cron that updates the permission once a file is created or check for any new file in the corresponding directory and update its permissions.
Feb 5 '09 #2
Nepomuk
3,112 Expert 2GB
Another option would be to overload the cd command with a local script, so that if checks if the directory that it's changing to is in one of these places and if so change the default group.

Greetings,
Nepomuk
Feb 5 '09 #3
Change group owner ship of each directory first, then add setgid bit on each
directory. setgid allows to inherit parent directory GID, when file or
directory created in that directory. To know mor about setgid, setuid
check bellow link.
Advanced Linux/UNIX file permissions
Mar 30 '10 #4
ennoil
11
To do what you want, as written, is impossible. To change a user's primary group requires them to log out and log back in again. You will need to, as suggested above, use setGID to allow users to act on the directory as the primary group.
May 28 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jami | last post by:
I can retrieve all the group members using the "memberof" property but I can't get the Primary Group Name. The only thing I get back is the "primarygroupid." How do you get the primary group...
9
by: 101 | last post by:
Taking a course on SQL. They are saying you can get better performance by having multiple files for a group. They then graphically show an example of "Primary" with multiple data files. I have...
4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
0
by: Jami | last post by:
I can retrieve all the group members using the "memberof" property but I can't get the Primary Group Name. The only thing I get back is the "primarygroupid." How do you get the primary group...
2
by: ffmelo | last post by:
Hi, I have a user object (Directory Entry). How do I to get the groups which this user is member. I am using the LDAP. thanks. Posted Via Usenet.com Premium Usenet Newsgroup Services
3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
6
by: Jan | last post by:
Hi: I have created a secured database for a client. For various reasons, I don't want the client to have full persmissions for the database; they aren't in the admins group. I have instead tried...
9
by: Brian Hampson | last post by:
I am trying to determine all the groups which the current user has permissions to add a member. Here's my code: foreach (System.DirectoryServices.SearchResult ADSearchres in...
9
by: Matuag | last post by:
Hi All, Is there anyway we can create different Usernames, user levels and passwords in Access 2007? I could not find any icons for this on the ribbon. I have created Notes History using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.