-1

I want to create unix file with permission of 755. if I use umask of 022, the file gets created with 644. Why is that? Why files are not getting created with execute permission? What's the way around?

Brijesh
  • 131
  • 1
  • 1
  • 5
  • Because most file are not executable — you have to add execute permission. – Jonathan Leffler Apr 01 '19 at 17:59
  • The program specifies the maximum allowable permissions through the open syscall (usually `0666` for files and `0777` for directories, but sometimes e.g. `0600` for ssh private keys). The umask only subtracts permissions from that, it can't add any. Your file does not become `0755` because the program asked that that it be created without execute permissions. – that other guy Apr 01 '19 at 18:00

1 Answers1

1

The x permission is not applied by default to files. It is applied to directories, and compliation programs like "make" will apply it to executable files. Beyond that, for the most part, the x permission must be applied manually.

hymie
  • 1,982
  • 1
  • 13
  • 18