Unix questions - groups memebrs

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > January 2006 > groups memebrs





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author groups memebrs
maca

2006-01-03, 7:50 am

Hello all;
on unix sys: how to know to which Groups a user is a member.
I have changed the username of a user with Usermod but
the new username is not a member of any groups of the old one
any suggestions
I want to create a new user with same membership and files etc ... for
an existing user
thanks a lot
maca

Dave

2006-01-03, 6:02 pm

maca wrote:
> Hello all;
> on unix sys: how to know to which Groups a user is a member.
> I have changed the username of a user with Usermod but
> the new username is not a member of any groups of the old one
> any suggestions


look in /etc/passwd. The 4th field is the gid of the group.


Then look in /etc/group, to see what the name of that group is.

> I want to create a new user with same membership and files etc ... for
> an existing user
> thanks a lot
> maca
>


I don't know for your specific UNIX variaent, but on Solaris

# useradd -g groupname ....

will work. You can use either the groupname or the gid.
--
Dave K

http://www.southminster-branch-line.org.uk/

Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@domain. Hitting reply will work
for a couple of months only. Later set it manually. The month is
always written in 3 letters (e.g. Jan, not January etc)
Kevin Collins

2006-01-03, 8:58 pm

In article <43ba91f5@212.67.96.135>, Dave wrote:
> maca wrote:
>
> look in /etc/passwd. The 4th field is the gid of the group.
>
>
> Then look in /etc/group, to see what the name of that group is.


That only tells you what group is the primary group of the user, and NOT what
groups the user is in.

>
> I don't know for your specific UNIX variaent, but on Solaris
>
> # useradd -g groupname ....
>
> will work. You can use either the groupname or the gid.


You want to look at the /etc/group file. Search for existing user's user name
and you will find all the groups it belongs to. You can then add your new user
to the same groups.

Optionally, you can use the 'groups' command to see which groups the 1st user
belongs to:

# groups user1

And then user useradd or usermod with the -G option. See 'man useradd' and 'man
usermod' for more info. Assuming, of course, that your platform supports
useradd/usermod.

Kevin
--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, PERL and CGI scripting
http://www.unix-guy.com
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com