5

I want a way by which whenever I create a new file in a particular directory, I want it to be executable by default.

Is this even possible, if so how?

Hashken
  • 6,282
  • http://stackoverflow.com/questions/580584/setting-default-permissions-for-newly-created-files-and-sub-directories-under-a/13906099#13906099 – Rinzwind Oct 01 '13 at 14:29
  • This is the easiest to read document regarding ACL (Access Control Lists) I could find: https://help.ubuntu.com/community/FilePermissionsACLs – Rinzwind Oct 01 '13 at 14:42

2 Answers2

1

You can change permission of a directory using the following command
chmod -R 700 directory

where -R ----> recursively apply permission all sub-directories and files under directory

Naive
  • 4,825
  • 11
  • 27
  • 35
  • 1
    By my understanding, this will mark all existing files as executable, but any new files written after running this will not be. – Kevin Jun 07 '15 at 00:26
0

It depends, how you create the file. If you want strict executable for the creator only, than use:

chmod 100 myfile

If you need read-write access as well:

chmod 700 myfile

A little help: http://www.meine-erste-homepage.com/chmod-generator.php

Automatic creation can be done wuth install (part of coreutils):

install -b -m 700 /dev/null myfile
Frantique
  • 8,493