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?

2 Answers 2


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

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .