Single command to create a file and set its permission
install -m 777 /dev/null filename.txt
install -m 777 /dev/null filename.txt
Since version 1.8, Ansible supports symbolic modes. Thus, the following would perform the task you want: – name: Make my directory tree readable file: path: dir mode: u=rwX,g=rX,o=rX recurse: yes Because X (instead of x) only applies to directories or files with at least one x bit set.
I found that the problem indeed is the antivirus “real time file system protection”. I do the following to fix the problem: trace(utils:::unpackPkgZip, edit=TRUE) I edit line 140 (line 142 in R 3.4.4): Sys.sleep(0.5) to: Sys.sleep(2) I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds … Read more
An easy way is to let PHP create the directory itself in the first place. <?php $dir=”myDir”; // create new directory with 744 permissions if it does not exist yet // owner will be the user/group the PHP script is run under if ( !file_exists($dir) ) { mkdir ($dir, 0744); } file_put_contents ($dir.’/test.txt’, ‘Hello File’); … Read more
git 2.9.X/2.10 (Q3 2016) brings chmod to git add itself! See commit 4e55ed3 (31 May 2016) by Edward Thomson (ethomson). Helped-by: Johannes Schindelin (dscho). (Merged by Junio C Hamano — gitster — in commit c8b080a, 06 Jul 2016) add: add –chmod=+x / –chmod=-x options The executable bit will not be detected (and therefore will not … Read more
Check this question out: What user do python scripts run as in windows? Apparently the answer is to change the file/folder to not be read-only and then remove it. Here’s onerror() handler from pathutils.py mentioned by @Sridhar Ratnakumar in comments: def onerror(func, path, exc_info): “”” Error handler for “shutil.rmtree“. If the error is due to … Read more
Directory.GetAccessControl(path) does what you are asking for. public static bool HasWritePermissionOnDir(string path) { var writeAllow = false; var writeDeny = false; var accessControlList = Directory.GetAccessControl(path); if (accessControlList == null) return false; var accessRules = accessControlList.GetAccessRules(true, true, typeof(System.Security.Principal.SecurityIdentifier)); if (accessRules ==null) return false; foreach (FileSystemAccessRule rule in accessRules) { if ((FileSystemRights.Write & rule.FileSystemRights) != FileSystemRights.Write) continue; … Read more
For those with this problem, add this to AndroidManifest.xml: <uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE” /> Problem solved 😀 EDIT: If this does not work just make sure if path is correct
This started popping up immediately after I created another user with Administrator privileges, and that account began inheriting access to my .ssh folder. You do not need to change your permissions whatsoever. Just go to .ssh, right-click Properties, Security Tab, Advanced. DISABLE INHERITANCE, then click on the Administrator user (the one that is not you) … Read more