Making new files automatically executable?
The umask merely subtracts default file and directory permissions.
777 initial file permissions111 execute bit is not set by default---666 default file permissions022 subtract default Unix umask---644 voila, final file permissions
The execute bit must be set for the owner to cd into a directory of their creation, so user-execute permission is set, resulting in directory permissions of 744, when using the above umask.
I have found no way to setting which would set the execute, by default. This would be bad mojo, anyway, but I am currently researching for a cyber security course I am writing.
In a safe way? No.In an unsafe manner: just change the umask
by adding umask xxx
in your ~/.bashrc
file, where xxx
represents the permission mask you wish.
Notes:
- This is unsafe (did I already mention it? Other did.)
- It may leads to many issues. One being the creation of filesdisallowed on some systems)
Recommended way:
Only do it for files that actually need the execute permission.
chmod +x /the/file