Operating System - HP-UX
1834903 Members
2822 Online
110071 Solutions
New Discussion

Why permissions different on different directory with mkdir command ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

Why permissions different on different directory with mkdir command ?

I tried to do :
mkdir test
in /users/testuser dir. and SGID is set on the directory.
If I run the same command in another directory like /tmp or /home the the perms are different .(no SUID set). I am executing mkdir as root in both directories.
Why ?

HPUX 11.00

See ex. below
========================
SERVER1::/users/testuser ==> umask
07
SERVER1::/users/testuser ==> id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7
(lp),20(users)
SERVER1::/users/testuser ==> mkdir test
SERVER1::/users/testuser ==> ls -ld test
drwxrws--- 2 root testuser 96 Aug 22 10:34 test
SERVER1::/users/testuser ==>


=================================

SERVER1::/tmp ==> mkdir test
SERVER1::/tmp ==> ls -ld test
drwxrwx--- 2 root sys 96 Aug 22 10:34 test
SERVER1::/tmp ==> umask
07
SERVER1::/tmp ==> id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7
(lp),20(users)
SERVER1::/tmp ==>
good judgement comes from experience and experience comes from bad judgement.
4 REPLIES 4
Stefan Farrelly
Honored Contributor
Solution

Re: Why permissions different on different directory with mkdir command ?

check the permissions on the directory above;
(on server1) ll -d /users/testuser

It must have SGID on it which is then copied to any subdirs created under it.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Vitek Pepas
Valued Contributor

Re: Why permissions different on different directory with mkdir command ?

SGID is derived from parent directory. You have it set for /user/testuser, therefore it's subdirectories will have it, too.
Sammy_2
Super Advisor

Re: Why permissions different on different directory with mkdir command ?

Bingo !!Stefan and Vitek. My mistake. You are right that
/users/testuser have SGID. Should have checked myself.
Much thanks.
good judgement comes from experience and experience comes from bad judgement.
Umapathy S
Honored Contributor

Re: Why permissions different on different directory with mkdir command ?

Sam,
The parent dir surely has SGID set. Check that out.

-Umapathy

Arise Awake and Stop NOT till the goal is Reached!