[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
chmod feature request: setting different modes for files and directories
From: |
Tobia Conforto |
Subject: |
chmod feature request: setting different modes for files and directories |
Date: |
Mon, 10 Aug 2009 15:40:57 +0200 |
Dear coreutils maintainers,
I'd like to ask for an often needed feature of chmod: the ability to
set different modes for files and directories. I will briefly explain
the need, and then propose a possible syntax.
For example, to make a directory setgid, one needs to give the setgid
permission to all sub-directories already present, but not to the
files. Currently one has to write something like this:
find some/path -type d -exec chmod g+s {} +
Or some variation with -print0 and xargs. The same is true when
someone extracts some files from an archive or copies them over a
removable media, where permissions need to be reset to something sane,
like 755/644:
chmod -R 755 another/path
find another/path -type f -exec chmod 644 {} +
These could all be written more concisely if chmod supported selection
of permissions by inode type. Here is the syntax I'm thinking about,
for the two examples above:
chmod -R d:g+s some/path
chmod -R d:755,f:644 another/path
This is backwards-compatible, intuitive, and concise. The character
before the colon could be made to mimic find's -type option.
Let me know if you'd like me to come up with an implementation, or if
there is some other list where this topic would be more appropriate.
-Tobia
- chmod feature request: setting different modes for files and directories,
Tobia Conforto <=