paulpotat - 2022-12-13

Hello,

I have a problem with the CAA File library : every file created using the Open FB is read-only for everyone but the root user.

For example, when i do this to create the file :

(*#-#-#-#-#-#-#-#-#-#---Declaration---#-#-#-#-#-#-#-#-#-#-#-#-#*)
file_op : FILE.Open;

(*#-#-#-#-#-#-#-#-#---Implementation---#-#-#-#-#-#-#-#-#-#-#-#*)
file_op.sFileName := 'path/to/my_file';
file_op.eFileMode := FILE.MODE.MWRITE;
file_op.xExclusive := FALSE;
file_op(xExecute:=TRUE);
IF file_op.xDone THEN
    file_handler := file_op.hFile;
    file_op(xExecute:=FALSE);
END_IF

Then my_file will have the following permissions :

-rw-r--r-- 1 root root    0 Dec 13 11:38 my_file

How can I change this to also give write access to normal users ? I would want to get something like this :

-rw-rx-r-- 1 pi pi    0 Dec 13 11:38 my_file

I am aware that I can do this using bash commands. However, I would like to know if I can directly create the file with the correct permissions inside my CodeSys application ?

Hope somebody can help me with this
BR