![]() |
|
|
|
|
|||||||
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| doubt in awk | jisha | Shell Programming and Scripting | 4 | 04-16-2008 01:02 AM |
| doubt about awk | soujanya_srk | UNIX for Dummies Questions & Answers | 2 | 01-10-2008 01:26 PM |
| Pls help for the doubt | ravi.sadani19 | Shell Programming and Scripting | 4 | 04-12-2007 01:51 AM |
| doubt in sed | matrixmadhan | UNIX for Dummies Questions & Answers | 3 | 08-03-2005 08:34 AM |
| doubt it sed | esham | Shell Programming and Scripting | 2 | 03-07-2005 09:52 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
strange doubt in users
confused with this strange doubt
abc is my login id ls -l | grep abc drwxr-xr-x 13 abc req 1024 Jun 21 22:50 abc i just reset my group from req to try by changing the entry in /etc/passwd but still ls -l | grep abc drwxr-xr-x 13 abc req 1024 Jun 21 22:50 abc instead of try strange thing is i have a program that would execute only if the group is try and now i am able to execute that (seems grp has been changed but i couldnt reflect the change in /users/ ) what could be the reason? hope i make things clear |
| Forum Sponsor | ||
|
|
|
|||
|
now i tried
chgrp try /users/abc/ ls -l | grep abc drwxr-xr-x 13 abc try 1024 Jun 21 22:50 abc i have the effect of the above chgrp command only for /users/abc/ the file that i had specified in chgrp but still the file /users/abc/sub is in req group could somebody help me with this? |
|
|||
|
*i have never played with groups BUT* How hard/disasterous would it be to just go and delete the group and remake it. There has to be some script or something out there to collect the names of the users in the group then delete the group and put it back together. As i said i havent played with groups but just a thought.
Someone once said "The hardest problems are solved by the most obvious solutions, you just need someone else to tell you what it is." Heh this is so true.....sometimes you get so frustrated you don't see the obvious. |
|
|||
|
There are a couple things going on here. First, when you change your group in /etc/password it changes which group you belong to, but that won't have any effect on files that are already created. From now on, all files you create will have group try, but anything from before won't change.
That is why in your second post you needed to do the chgrp. When you did the chgrp try /user/abc, that will change the group for JUST /user/abc. If you want it to change the group for everything below you need to tell the chgrp command that. In Solaris it would be: chgrp -R try /user/abc If you are using a different Unix version just check the manpage for chgrp to verify that the switch is -R for you as well. Hope that clears it up for you. Last edited by rhfrommn; 12-02-2005 at 08:10 AM. Reason: Added more information |
|
|||
|
Thats very true,
after changing the group in /etc/passwd all the files hence forth created will have the current group and not the older ones Assumed when group is changed for a user the home directory of the user which in turns contain an unique inode, would change its group name based on the group id identified from the file. Wouldn't the contents of the inode(group name) be refreshed with the current one? Would appreciate very much if somebody explains at the level of inodes? Thanks, Mad |
|
|||
|
Looking at the inode level doesn't really change things. The filesystem stores information about the file including the numeric group ID for it in an inode. But that still isn't linked to the user account in a "live" fashion. Once the file is created the information is set. You can change the default group for the owner, but the file (and the inode) still doesn't know about that. You need to use a command like chmod or chgrp to edit that information.
You could use switches on an ls command to get more information about this. Maybe making a test account, homedir, and some files then playing around with it would help make it more clear. For example, in solaris ls -n will print the numeric group and user IDs instead of the names of the group and user. Also -i will print the inode number as part of the long listing. I'm not sure if that answers your question, but I think it should. |
|
|||
|
group modification as i had thought - presumed to reflect the group name changes as and when a group is changed,
but as u had said it didn't but managed to bring all the files (new one's and the existing ) under a single group chgrp -R <newgroupname> ~user but still to continue with the doubt, sorry if i am churning out the same stuff. how does the ls manages to list the files with the previous group name (the group to which the user currently doesnt belong) it was in and no wonder how it lists the newly created files after the group change? |
|
|||
|
When you create a file the filesystem evaluates your UID (say:4711) and your effective groups ID (say: group 0815) and now writes file xy. Basically the directory entry (the inode) states that user nr. 4711 (whatever his name is) and group 0815 (whatever its name is and whoever belongs to it) owns this file.
THIS INFORMATION NEVER CHANGES (until explicitly done so by chown, etc.). If you delete your user now you will see that an "ls -l" shows a number instead of the name - the user nr of the deleted user account - and if you delete the group you would see a number instead of the groups name too - the file is still owned by user nr 4711 or group 0815, but this user and/or this group does not exist any more and therefore the ls command can't tell you who this should be. If you create a new user with the same user nr as the old user (or a group with the same group nr as the old group) the file will belong to this new user or group - because now there there is a user 4711 (regardless of what his name is) again. If you create a user or group with the same name as before but different UIDs (user numbers) the user/group won't own the file because exactly this connection is missing. If you take an existing group/user and change its name the connection is still there - its done via the UID/GID and this is not affected by the name change. If you change the UID/GID this connection is broken and you do not own the file any more. Clearer now? bakunin |
|||
| Google UNIX.COM |