Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to `mkdir' a directory, whose privileges are same the existing direcotry

How to `mkdir' a directory, whose privileges are same the existing direcotry

Hi forks,

I would like to implement the following functions in HP-UX,

# ll -d /foo/

and I would like to do `mkdir /tmp/foo', whose privileges and owner/group are same with /foo

How can I do that?

Thanks
-- Jerry
3 REPLIES
Steven E. Protter
Exalted Contributor

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

Shalom Jerry,

Few ways.

1) Set the umask to the default that causes creation to be the correct. That is the simple way.
2) Have your script change permissions after creation
3)Create a situation where the mkdir is a subdirectory of a master directory and use chmod 3### (### are numbers) to create a parent child relationship concerning permissions.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

Hello Steven E. Protter ,

Thanks for your help, but if you notice the
sign `#', that mean I am the superuser and have a root privilege,

So what I want is,
# ll -d /dev
dr-xr-xr-x 13 bin bin 8192 Jan 10 01:53 /dev

and I want to mkdir in /tmp/dev/, which mode are set to same as the real one /dev/

-- Jerry
Dennis Handly
Acclaimed Contributor

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

>which mode are set to same as the real one /dev/

See my permission copying scripts in this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1215123