Operating System - HP-UX
1834639 Members
2406 Online
110069 Solutions
New Discussion

add mutiple groups to one users

 
SOLVED
Go to solution
szhiyong
Frequent Advisor

add mutiple groups to one users

Hi,

I want to assign one user to multiple groups, such as the user name is zhiyong, groups:root,neuroadmin. I want to get such result:
When I login in as zhiyong, create directory
"/usr4", then I "ls -l", I can see at "/"
directory:
usr4 zhiyong neurouadmin

Would someone please tell me how to do this?

Thanks a lot.

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing
4 REPLIES 4
Rodney Hills
Honored Contributor

Re: add mutiple groups to one users

Be sure to do-

ln /etc/groups /etc/logingroup

Then you will have access to the groups.

-- Rod Hills
There be dragons...
szhiyong
Frequent Advisor

Re: add mutiple groups to one users

Hi,

I created zhiyong as members of root and users, users is primary group of zhiyong,but I try to creat a directory in "/", it has error message:
access ".": permission denied.

Would someone tell me how to solve this problem?

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing
Michael Tully
Honored Contributor
Solution

Re: add mutiple groups to one users

Hi Zhiyong,

Try this:

Your entry in /etc/group should be this, entry added by root:

root::0:root,zhiyong

You need to add this group to your currently used groups as below:

zhiyong@psdev1:/home/zhiyong 367 $ newgrp root
zhiyong@psdev1:/home/zhiyong 365 $ id
uid=342(zhiyong) gid=0(root) groups=30(staff)
zhiyong@psdev1:/home/zhiyong 366 $ mkdir /test
zhiyong@psdev1:/home/zhiyong 367 $ ll -ld /test
drwxr-xr-x 2 zhiyong root 96 Jul 30 10:48 /test

HTH
Michael
Anyone for a Mutiny ?
szhiyong
Frequent Advisor

Re: add mutiple groups to one users

Hi,

Thanks a lot.

I solved the problem.

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing