file-permissions

Open a file with su/sudo inside Emacs

喜你入骨 提交于 2019-11-27 08:57:09
问题 Suppose I want to open a file in an existing Emacs session using su or sudo , without dropping down to a shell and doing sudoedit or sudo emacs . One way to do this is C-x C-f /sudo::/path/to/file but this requires an expensive round-trip through SSH. Is there a more direct way? [EDIT] @JBB is right. I want to be able to invoke su / sudo to save as well as open. It would be OK (but not ideal) to re-authorize when saving. What I'm looking for is variations of find-file and save-buffer that can

How can I copy permissions from a file that already exists?

人走茶凉 提交于 2019-11-27 08:20:37
问题 I have to write a program in C (on a Unix-like system) and this is my problem: I have a file (FILE1) and I want to create another file (FILE2) which has the same permissions of FILE1. Then I have to create another file (FILE3) which has the same permissions of FILE1 but only for the owner. I would use chmod() to change permissions but I don't understand how to obtain the permissions of FILE1. Can you please help me? 回答1: The stat() and fstat() functions retrieve a struct stat , which includes

Howto avoid the “EACCES permission denied” ON SDCARD with KITKAT 4.4.2 Version. New policy from google

試著忘記壹切 提交于 2019-11-27 08:03:09
With the android kitkat 4.4.2 version is a new google policy implemented for writeaccess, which I do not understand so far. I read a lot about this issue with other apps. They get a "EACCES permission denied". My app needs to write/unzip a zipfile, also write to a sqlite-database. How can this EACCES permission denied issue be solved with Android version 4.4.2 KITKAT ? WiFi I found a working solution to this issue in xda forum ; there is no need for rooting. Here's an example : /** * Returns an OutputStream to write to the file. The file will be truncated immediately. */ public OutputStream

How to change permission recursively to folder with AWS s3 or AWS s3api

为君一笑 提交于 2019-11-27 06:03:53
问题 I am trying to grant permissions to an existing account in s3. The bucket is owned by the account, but the data was copied from another account's bucket. When I try to grant permissions with the command: aws s3api put-object-acl --bucket <bucket_name> --key <folder_name> --profile <original_account_profile> --grant-full-control emailaddress=<destination_account_email> I receive the error: An error occurred (NoSuchKey) when calling the PutObjectAcl operation: The specified key does not exist.

java set file permissions to 777 while creating a file object [duplicate]

耗尽温柔 提交于 2019-11-27 05:34:17
Possible Duplicate: How can I set the umask from within java? How do you set file permissions to 777(or any other arbitrary permission) while creating a file object in java? If you set the umask(2) to 0 before starting the JVM, all files and directories created will be created with full permissions for everyone. This is probably a bad idea. You can use the File.setReadable() , File.setWritable APIs to fiddle with the mode bits after the file has been created. That's often good enough, if you're granting permissions; if you're trying to remove permissions from other users, then your permissions

java.security.AccessControlException: Access denied (java.io.FilePermission

ぃ、小莉子 提交于 2019-11-27 04:59:41
final File parentDir = new File("S:\\PDSPopulatingProgram"); parentDir.mkdir(); final String hash = "popupateData"; final String fileName = hash + ".txt"; final File file = new File(parentDir, fileName); file.createNewFile(); // Creates file PDSPopulatingProgram/popupateData.txt I am trying to create a file in a folder but I am getting exception as java.security.AccessControlException: Access denied I am working in windows environment. I can create a folder from the Windows Explorer, but not from the Java Code. How can I resolve this issue? Petey B Within your <jre location>\lib\security\java

Writing to the internal private storage in Android

丶灬走出姿态 提交于 2019-11-27 04:34:04
问题 I am trying to save some data from my app in a simple text file on the internal private storage area (app user preferences). I have read through many questions on here (StackOverflow) and tried the solutions suggested with no success. The simplest solution, it seems, would be the one suggested here: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal but I cannot get this to work on my test device. I have also tried to create the file using the methods available in

Git is changing my file's permissions when I push to server

爷,独闯天下 提交于 2019-11-27 04:14:27
I am using git to manage a website on a server. I have a local repository shown below local@workstation:myapp$ ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf("%0o ",k);print}' total 16 755 drwxr-xr-x@ 18 thomas staff 612 Jun 13 15:35 application 755 drwxr-xr-x@ 11 thomas staff 374 Jun 12 16:25 assets 644 -rw-r--r--@ 1 thomas staff 6399 Jun 22 11:45 index.php 755 drwxr-xr-x@ 10 thomas staff 340 May 14 15:22 system I have a bare repository on the server that uses post-receive to point the repo in front of apache. Apache's public folders contents are below

Howto avoid the “EACCES permission denied” ON SDCARD with KITKAT 4.4.2 Version. New policy from google

雨燕双飞 提交于 2019-11-27 04:00:09
问题 With the android kitkat 4.4.2 version is a new google policy implemented for writeaccess, which I do not understand so far. I read a lot about this issue with other apps. They get a "EACCES permission denied". My app needs to write/unzip a zipfile, also write to a sqlite-database. How can this EACCES permission denied issue be solved with Android version 4.4.2 KITKAT ? 回答1: I found a working solution to this issue in xda forum; there is no need for rooting. Here's an example : /** * Returns

why my file permission being changed after pull from git repository

自作多情 提交于 2019-11-27 03:38:51
问题 I have been came across this problem over and over again. I have a git repository set up on my remote server and all the files are set to 644 and folders are set to 755. However, every time after i pulling from git repository(i'm using bitbucket), i noticed the permission of the file which i modified was changed into 664 which results a Internal server Error. For example, I changed the index.php, and it occurs 500 when i tried to get access to it i have to use find . -type d -print0 | xargs