I have a directory with name 'test' that has permissions 0777.

I have a script to write files to the directory 'test'. However, these files have, by default, permission 0644.

I need these files to inherit the folder permissions.

Can anyone please help me achieve this?


When you create new file you can't make it by default executable. Even if your umask is 000. This is in UNIX/Linux by design. You can always add execution permission postfactum:

chmod +x filename
|improve this answer|||||

See How to make the newly created files inherit the directory's permissions…?

Its solution may help you with similar questions.

But try to limit permission; 0777 is rarely really needed.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.