Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have changed permissions in /var/www into 775 with:
chmod -R 775 /var/www
however when i create a new file from nautilus it has permissions 500
this means that it's not available to the group and also that
i have to chmod all my php scripts when i create them. new files and dirs created from command line have 755
How can i do it so that every new file or dir created either from nautilus (or other software) or from the command line to have the /var/www's permissions (aka 775)
Nice link but not what i was looking for.
My problem is not how to change permissions recursively but also how to make all newly created dirs and files inherit permissions from the parent directory (like it happens in windows).
For example my /var/www is 775 and when i create a new file as a user of the group that owns /var/www it has permissions 644. I would expect (or wish at least) everything created inside /var/www to have 775 permissions...
This is impossible, file permissions cannot be inherited in this way. You can set the default file permissions with an appropriate umask (012 or 002) but you cannot set execute permission with umask, you have to use chmod for this. If you're too lazy to type chmod after creating a script (as you should be, laziness in a programmer being a virtue of course), then you can write a wrapper script around your text editor to do it automatically based on file extension (.php, .sh etc).
Personally I write all my scripts in ~/src/sh, ~/src/python etc and install them with an 'installscript' script, which does a chmod +x and copies it to ~/bin or wherever. This lets me edit/test scripts without munging a working version, which may be still in use.
Last edited by soggycornflake; 08-29-2006 at 01:17 PM.
omg ! It's a huge limitation for any OS and a pitty that linux can't inherit permissions.
However the 'installscript' script is a nice idea (or perhaps a 'newscript' script) and will make my life easier. Thanks
This is impossible, file permissions cannot be inherited in this way. You can set the default file permissions with an appropriate umask (012 or 002) but you cannot set execute permission with umask, you have to use chmod for this. If you're too lazy to type chmod after creating a script (as you should be, laziness in a programmer being a virtue of course), then you can write a wrapper script around your text editor to do it automatically based on file extension (.php, .sh etc).
Personally I write all my scripts in ~/src/sh, ~/src/python etc and install them with an 'installscript' script, which does a chmod +x and copies it to ~/bin or wherever. This lets me edit/test scripts without munging a working version, which may be still in use.
Oh, yeah, I expect so (never used them myself). I just meant you can't do it with the default unix permissions mechanism.
Quote:
Originally Posted by thejasondean
omg ! It's a huge limitation for any OS and a pitty that linux can't inherit permissions.
It would be handy in some situations, but I wouldn't call it an essential feature.
Quote:
Originally Posted by jayakrishnan
To set the default file permision to 775 use
umask 002
That won't automatically set execute permissions though, which is what thejasondean wanted.
Quote:
Originally Posted by thejasondean
Will that change the default file permissions globaly ? For all sessions ?
Unless otherwise specified, when a file is created the permissions are determined from the umask. The resulting permissions are 666 logically anded with the umask. Most distros use a default umask of 022, which results in 644 file permissions. This applies to the current shell, and will be inherited by processes spawned by the shell (though of course, processes can change their umask at will). As I mentioned before though, you cannot set execute permissions automatically via the umask. There is also no way to force particular file permissions globally with the standard unix permissions mechanism, though you should be able to achieve it with ACLs as magnus.therning pointed out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.