Files created with Cygwin (shell script invocation) do not have proper Windows permissions

I am currently running Cygwin on the target Windows Server 2003 machine to run a shell script that, among other things, creates a bunch of files on disk. However, after creating the files, I no longer have the rights to manage them through Windows.

When files are created, the owner gets the value "SYSTEM", and permissions for Administrators/Creator Group/Creator Owner/system are set only for "special permissions" and nothing more. Permissions for all and users have read and execute, list folder contents and read.

My problem is that I cannot delete / modify files now through Windows. I would prefer something built into my scripts (either a shell script, or something to call in Cygwin), which would allow administrators to fully control the folder and all content.

My current workaround was to either modify the files via Cygwin, but this is not preferable. I also used setfacl -r -m default:other:rwx to add write setfacl -r -m default:other:rwx for the Users group, but it does not have a recursive option and still does not give "full control"

Is there a better way to use setfacl ? Is it possible to invoke a shell script using different / elevated permissions?

The getfacl results in the newly created directory:

 $ getfacl Directory/ # file: Directory/ # owner: SYSTEM # group: root user::rwx group::rx group:Users:rwx mask:rwx other:rx default:user::rwx default:group::rx default:group:Users:rwx default:mask:rwx default:other:rx 
+8
windows bash cygwin
source share
1 answer

You can try installing umask :

 umask u=rwx,g=rwx,o=rwx 

This should give the user, group, and other read / write / execute programs on all newly created servers.

If you want the modified umask permanently, you can add it to your .bash_profile


Edit - Added mkdir example before / after umask.

Here is the getfacl output in the directory created before I installed umask :

 [/cygdrive/c/Documents and Settings/NOYB/Desktop] ==> getfacl test_wo_umask/ # file: test_wo_umask/ # owner: NOYB # group: Domain Users user::rwx group::rx group:root:rwx group:SYSTEM:rwx mask:rwx other:rx default:user::rwx default:user:NOYB:rwx default:group::rx default:group:root:rwx default:group:SYSTEM:rwx default:mask:rwx default:other:rx 

Here is the output of getfacl in the directory created after I installed umask :

 [/cygdrive/c/Documents and Settings/NOYB/Desktop] ==> getfacl test_w_umask/ # file: test_w_umask/ # owner: NOYB # group: Domain Users user::rwx group::rwx group:root:rwx group:SYSTEM:rwx mask:rwx other:rwx default:user::rwx default:user:NOYB:rwx default:group::rwx default:group:root:rwx default:group:SYSTEM:rwx default:mask:rwx default:other:rwx 
+4
source share

All Articles