I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions.

Is there any way to specify file permissions at the same time as creating the file? C’s creat function allows me to specify S_IRUSR | S_IWUSR. Is there any equivalent in Elixir?

1 Like

As far as I understand, the BEAM is more highlevel than that and provides an abstraction that generally works with linux and windows the same.

So any file created will just have the umask applied.

Perhaps you can use install to create and set permissions for an empty file at the same time as suggested in this stack overflow answer?

1 Like