file-permissions

Permissions on log files created by log4j RollingFileAppender

江枫思渺然 提交于 2019-11-26 20:53:26
问题 How are the permissions for files created by RollingFileAppender determined? I recently changed a daemon process I have to be run as a non-root user and the files are now being created with permissions of 0600 (only readable by the owner), but I would like them to be readable by all or at least members of an admin group ( 0644 or 0640 ). Files created by my tomcat apps are always 0644 (readable by all). I don't know if I inadvertently changed something else or if it is something to do with

Can't create folder on external storage on android

梦想的初衷 提交于 2019-11-26 20:17:41
问题 My development phone is a Nexus 5 , running Android 4.4.2 . In my application, I am attempting to create a folder on external storage that will store debug information for my application. Basically it will contain all the commands executed by the application, so that when a user encounters a problem, I have the option of having them send me the information from the debug folder to analyse. I started off by trying to write a file to the folder, but found there was an error creating the folder.

Changing file permission in Python

家住魔仙堡 提交于 2019-11-26 20:05:52
I am trying to change permission of a file access: os.chmod(path, mode) I want to make it read-only: os.chmod(path, 0444) Is there any other way make a file read-only? os.chmod(path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) stat The following flags can also be used in the mode argument of os.chmod(): stat.S_ISUID Set UID bit. stat.S_ISGID Set-group-ID bit. This bit has several special uses. For a directory it indicates that BSD semantics is to be used for that directory: files created there inherit their group ID from the directory, not from the effective group ID of the creating process,

Apache permissions, PHP file create, MKDir fail

心不动则不痛 提交于 2019-11-26 19:12:35
问题 It seems i cannot create files. When i set permissions to 777 On the folder i am trying to create a folder in then the script works fine. If the folder is set to 755, it fails. I do not know much about linux, but i am suppose to figure this stuff out. I have spent a couple hours trying stuff. Does anyone know how to make it so that apache has high enough permissions. I know it is a permissions and apache problem, i just do not know how to fix this. I have edited the httpd.conf file, but i

Check file permissions

怎甘沉沦 提交于 2019-11-26 18:32:52
问题 How can I check file permissions , without having to run operating system specific command via passthru() or exec() ? 回答1: Use fileperms() function clearstatcache(); echo substr(sprintf('%o', fileperms('/etc/passwd')), -4); 回答2: You can use the is_readable(), is_executable() etc.. commands. 回答3: Real coders use bitwise operations, not strings ;) This is much more elegant way of handling permissions: function checkPerms($path) { clearstatcache(null, $path); return decoct( fileperms($path) &

Creating executable files in Linux

最后都变了- 提交于 2019-11-26 18:03:39
问题 One thing I plan to be doing is writing (painfully simple) Perl scripts, and I'd like to be able to run them without explicitly calling Perl from the terminal. I appreciate that, to do this, I need to grant them execute permissions. Doing this with chmod is easy enough, but it also seems like a slightly laborious extra step. What I would like is one of two things: Firstly, is there a way to set the execute flag when saving a file? Currently I'm experimenting with gedit and geany, but would be

How can I exclude all “permission denied” messages from “find”?

自作多情 提交于 2019-11-26 18:02:35
I need to hide all permission denied messages from: find . > files_and_folders I am experimenting when such message arises. I need to gather all folders and files, to which it does not arise. Is it possible to direct the permission levels to the files_and_folders file? How can I hide the errors at the same time? Note: * This answer probably goes deeper than the use case warrants, and find 2>/dev/null may be good enough in many situations. It may still be of interest for a cross-platform perspective and for its discussion of some advanced shell techniques in the interest of finding a solution

How to restore the permissions of files and directories within git if they have been modified?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 17:59:36
I have a git checkout. All the file permissions are different than what git thinks they should be therefore they all show up as modified. Without touching the content of the files (just want to modify the permissions) how do I set all the files permissions to what git thinks they should be? Git keeps track of filepermission and exposes permission changes when creating patches using git diff -p . So all we need is: create a reverse patch include only the permission changes apply the patch to our working copy As a one-liner: git diff -p -R --no-color \ | grep -E "^(diff|(old|new) mode)" --color

Chmod 777 to a folder and all contents [duplicate]

夙愿已清 提交于 2019-11-26 17:52:56
问题 This question already has an answer here: How do I change permissions for a folder and all of its subfolders and files in one step in Linux? [closed] 16 answers I have a web directory /www and a folder in that directory called store . Within store are several files and folders. I want to give the folder store and all files and folders within the store folder all permissions. How do I do this? I am guessing via .htaccess. 回答1: If you are going for a console command it would be: chmod -R 777

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

无人久伴 提交于 2019-11-26 17:23:10
问题 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? 回答1: 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