- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mkdir -m 775 -p does NOT get parent permissions?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-22-2004 10:24 AM
тАО06-22-2004 10:24 AM
I've got a small problem with parental permissions.
[/tmp:]$ ll foo
foo not found
[/tmp:]$ mkdir -m 755 -p foo/bar
[/tmp:]$ ll -d foo foo/bar
drwx------ 3 dking users 96 Jun 22 18:20 foo
drwxr-xr-x 2 dking users 96 Jun 22 18:20 foo/bar
Why does the parent not get the permissions?
[/tmp:]$ ll -d foo2 foo2/bar2
foo2 not found
foo2/bar2 not found
[/tmp:]$ umask 000 ; mkdir -m 755 -p foo2/bar2
[/tmp:]$ ll -d foo2 foo2/bar2
drwxrwxrwx 3 dking users 96 Jun 22 18:23 foo2
drwxr-xr-x 2 dking users 96 Jun 22 18:23 foo2/bar2
Any help would be appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-22-2004 10:31 AM
тАО06-22-2004 10:31 AM
SolutionFrom the man page of mkdir
// For each directory name in the pathname prefix of the
dirname argument that is not the name of an existing
directory, the specified directory is created using
the current umask setting, except that the equivalent
of chmod u+wx is done on each component to ensure
that mkdir can create lower directories regardless of
the setting of umask. //
Hope that clarified your question.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-22-2004 10:31 AM
тАО06-22-2004 10:31 AM
Re: mkdir -m 775 -p does NOT get parent permissions?
-m mode After creating the directory as specified, the file
permissions are set to mode, which is a symbolic mode
string as defined for chmod (see chmod(1)). The
umask(1) has precedence over -m.
-p Intermediate directories are created as necessary.
Otherwise, the full path prefix of dirname must
already exist. mkdir requires write permission in
the parent directory.
For each directory name in the pathname prefix of the
dirname argument that is not the name of an existing
directory, the specified directory is created using
the current umask setting, except that the equivalent
of chmod u+wx is done on each component to ensure
that mkdir can create lower directories regardless of
the setting of umask. Each directory name in the
pathname prefix of the dirname argument that matches
an existing directory is ignored without error. If
an intermediate path component exists, but has
permissions set to prevent writing or searching,
mkdir fails with an error message.
If the -m option is used, the directory specified by
dirname (excluding directories in the pathname
prefix) is created with the permissions specified by
mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-22-2004 01:28 PM
тАО06-22-2004 01:28 PM
Re: mkdir -m 775 -p does NOT get parent permissions?
mkdir command works such.
how about writing as follows.
$ env umask=755 mkdir -p foo/bar
thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2004 02:16 AM
тАО06-23-2004 02:16 AM
Re: mkdir -m 775 -p does NOT get parent permissions?
umask 002 ; mkdir -m 775 -p foo/bar
Thanks, all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2004 02:32 AM
тАО06-23-2004 02:32 AM
Re: mkdir -m 775 -p does NOT get parent permissions?
Yes in your case but not always. The key is
//the specified directory is created using
the current umask setting, except that the equivalent
of chmod u+wx is done on each component to ensure
that mkdir can create lower directories regardless of
the setting of umask//
#umask 222
#mkdir parent1
#mkdir -p -m 555 parent2/child
#ll
total 0
dr-xr-xr-x 2 root sys 96 Jun 23 09:30 parent1
drwxrwxrwx 3 root sys 96 Jun 23 09:30 parent2
#ll parent2
total 0
dr-xr-xr-x 2 root sys 96 Jun 23 09:30 child
-Sri