Operating System - HP-UX
1834685 Members
2062 Online
110069 Solutions
New Discussion

how to create directory as specified group.

 
SOLVED
Go to solution
szhiyong
Frequent Advisor

how to create directory as specified group.

Hi,

I have one user called "neurousr", its primary group is users, it also belongs to additional groups such as sys and usrers.

Would someone please tell how neurousr to create a directory as members of sys? For example, neurousr create one directory "/usr4", the result of "ls -l" is:
usr4 neurousr sys
My life is now asking and learning, I wish It can change into replying and discussing
8 REPLIES 8
Steven Sim Kok Leong
Honored Contributor
Solution

Re: how to create directory as specified group.

Hi,

$ chgrp /usr4 sys

Hope this helps. Regards.

Steven Sim Kok Leong
Michael Tully
Honored Contributor

Re: how to create directory as specified group.

The directory will be created with permissions of user:primary group.

Sof if the user has a primary group of sys the directory will be created with those permissions. If it is not, you will need to change it with the 'chgrp' command.
Anyone for a Mutiny ?
S.K. Chan
Honored Contributor

Re: how to create directory as specified group.

As user "neurousr" run the command "newgrp" ..
$ newgrp sys
.. to switch group ownership to "sys". Now the "mkdir" command and you should see the group ownership will be owned by "sys".
szhiyong
Frequent Advisor

Re: how to create directory as specified group.

Hi,

Thanks a lot.

The newgrp and chgrp all works. I try to mount /dev/vg01/lvxxx /usr4. Then I "ls -l", I found the result is changed:
/usr4 root root

Would someone tell me how to make it as " /usr4 neurousr root" after mounting?

Thanks a lot again.

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

Re: how to create directory as specified group.

Hi,
First mount the user4 then do chgrp.
It will be alright.
Did you take a backup?
S.K. Chan
Honored Contributor

Re: how to create directory as specified group.

There is no point doing this because if this mount point is defined in /etc/fstab and the system reboots no matter what ownership you set for your mountpoint directory /usr4 it'll be changed to root:root everytime /usr is remounted. You should leave the ownership of the mount point as it is. Do not try to change it. Whatever permission/ownership for the subdirectories in /usr4 can be manipulated to your liking but not the mountpoint.
S.K. Chan
Honored Contributor

Re: how to create directory as specified group.

Apparently I was thinking NFS mounts. Obviously that does not apply to local mounts because root can definately change ownership of a local mount point, not necessarily true for remote mounting. So after you hav mounted it, simply change the ownership like suggested and subsequent mount will retain the directory ownership.
szhiyong
Frequent Advisor

Re: how to create directory as specified group.

Hi,

Thanks a lot for those good way of solving problem.

I used "change ownership" to solve it.

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