Operating System - HP-UX
1832955 Members
2766 Online
110048 Solutions
New Discussion

How obtain the group of the user

 
Rogelio Cabrera
Frequent Advisor

How obtain the group of the user

As I obtain the group of a user from its .profile file.
I wish that at the time of entering xyz user, to keep in a variable the name from the group to which it belongs.
My users have access to the server by Web, but I want to have this single access for a group.
I have hp-ux 11.0
Thanks and Greetings.
5 REPLIES 5
Ignacio Javier
Regular Advisor

Re: How obtain the group of the user


I do not know if this is what you want, but you could use this:

id | awk -F" " '{print $2}' | awk -F"(" '{print $2}' | awk -F")" '{print $1}'

to get the group the user belongs to, when yo execute the command.


Hasta luego Rogelio
Rogelio Cabrera
Frequent Advisor

Re: How obtain the group of the user

PERFECT IGNACIO, I WORK PERFECTLY THE SCRIPT.
THANK YOU VERY MUCH
ADIOS.
Rogelio Cabrera
Frequent Advisor

Re: How obtain the group of the user

THANK YOU VERY MUCH.
Jeff_Traigle
Honored Contributor

Re: How obtain the group of the user

It would be a lot simpler to simply execute:

id -gn
--
Jeff Traigle
Rogelio Cabrera
Frequent Advisor

Re: How obtain the group of the user

it is truth Jeff, and I believe that this option is better .

Thanks.