- Posts: 4
- Thank you received: 0
Inheriting rights
18 years 9 months ago #13282
by IIL
Inheriting rights was created by IIL
Can someone give me a tip how to make a new directory inherit rights from its parent directory?
18 years 9 months ago #13286
by nske
Replied by nske on topic Re: Inheriting rights
I don't know what kind of implementation for this you need, however here's a three-line bash script that would do just that (at least in gnu-linux).
[code:1]#!/bin/bash
MOTHERDIR=`dirname $1`
MOTHERPERM=`stat -c %a $MOTHERDIR`
mkdir -m $MOTHERPERM $1
[/code:1]
So i.e. you could put this in a file called /usr/bin/mkdir2, chmod +x /usr/bin/mkdir2; and then create your directories using 'mkdir2 /absolute/path/of/new/directory'
[code:1]#!/bin/bash
MOTHERDIR=`dirname $1`
MOTHERPERM=`stat -c %a $MOTHERDIR`
mkdir -m $MOTHERPERM $1
[/code:1]
So i.e. you could put this in a file called /usr/bin/mkdir2, chmod +x /usr/bin/mkdir2; and then create your directories using 'mkdir2 /absolute/path/of/new/directory'
Time to create page: 0.123 seconds