chmod

Image save doesn't work with chmod 755, but does with 777. What should I do?

不想你离开。 提交于 2019-12-12 05:21:51
问题 I have a website where users can crop images. I usually save cropped images under a folder with "755" chmod parameters. However, when it is 755, it doesn't work - It works when I chmod to 777 and I believe 777 is very insecure so I don't want to use it. What could be wrong? Ps. The system works like this. There are some pictures in server, PHP allows user to crop those images and when they click save, it should be saved on /cropped" folder. It works with 777 but not with 755. 回答1: File

php safe permissions for uploaded file

我的未来我决定 提交于 2019-12-12 02:39:15
问题 Q: What are safe permissions for upload folder and files uploading to that folder ? Wanted operations: folder = remove / create file = create / remove / rename / rewrite What chmod should I set? will they work with safe_mode = on ? 回答1: you can use umask so the permissions are set during file upload and you don't have to change them later. Back to your question. The default umask is usually 022 (755 for directories, 644 for files). The Other bit is important in order to allow access to a web

How to block file when you reading (fopen) it

我的未来我决定 提交于 2019-12-12 02:18:35
问题 How to block file when you reading it (by fopen or open in linux), to prevent any modifications during reading? What i have: 1 file with data; I want to read data from it in my function, so i use fopen(): FILE *file = fopen(fileName, "r"); Now i need something to block my file - any (or only current user's as variant) another process mustn't have any access (or only modify it as variant) to it until my function will allow them to do it I suppose, i can do that using set chmod flags for them

Recursive Chmod not working PHP

折月煮酒 提交于 2019-12-11 17:51:21
问题 I have the below PHP function that should recursively chmod one of the dir's on my server. For some reason it's not working - i know the path to the dir is correct as i've tested it with a quick script that just prints out the files within that dir. $root_tmp = '/tmp/mixtape2'; chmod_r($root_tmp); function chmod_r($Path) { $dp = opendir($Path); while($File = readdir($dp)) { if($File != "." AND $File != "..") { if(is_dir($File)){ chmod($File, 0777); chmod_r($Path."/".$File); }else{ chmod($Path

sudo chmod permission denied

不羁岁月 提交于 2019-12-11 16:28:07
问题 I accidentally executed the following command: sudo chmod -R 0700 /lib Now every single command (even with sudo) gives me a 'permission denied' (even simple commands like 'ls'). I got told because all the important executable files in the lib folder are not executable anymore. Basically my system is blocked. Is there a way to restore this (it is a server so reinstalling is not an option)? 来源: https://stackoverflow.com/questions/33281896/sudo-chmod-permission-denied

allow php files to write to locations other than those owned by www-data

走远了吗. 提交于 2019-12-11 12:52:23
问题 I am able to write content from a php file opened in the browser to a certain location /var/www/data which I configured as follows cd /var/www/ sudo mkdir data sudo chown www-data:www-data data sudo chmod 755 data However, is it possible to write similar data to another location like /var/www/html/MyProjectRootFolder which is not owned by www-data ? 回答1: Generally the web server's configuration is not going to allow applications to write to folders outside of their own Doc root. However, you

Ruby FileUtils.chmod in Windows

被刻印的时光 ゝ 提交于 2019-12-11 09:28:04
问题 So I have a Ruby script where I am moving files around and whatnot and, at a point in it, I need to set the permissions for some files so that when viewed from a UNIX machine, the permissions are being reflected accurately. The problem is, I am running the script from a Windows 64-bit machine and it doesn't seem to have any effect on the files when I view them from the UNIX machine. Here is my example code for the permissions: FileUtils.chmod(0777, "file") And that seems to have zero effect

Unable to Change File Permissions Even as Root

拈花ヽ惹草 提交于 2019-12-11 08:17:21
问题 I'm having a serious problem with an application I'm working on and I'm hoping someone here can help. The application has a feature that allows users to upload images to a folder on the production server. Users were reporting that the upload was not working properly, and when I dug into it further I noticed that the permissions were wrong. The underlying issue of why the permissions are off is something I will figure out later; right now I need to fix the permissions for the data that is

PHP can't write outside of the document root no matter what

折月煮酒 提交于 2019-12-11 07:56:14
问题 Running a VM with CentOS 5.7 with typical httpd install. I'm trying to write a file to a folder outside of /var/www/html , lets say in /var/somedir I've chmoded somedir with 777 I chowned it to apache:apache (root:apache didn't work either) PHP's safe_mode is off PHP's doc_root is empty (i.e. doc_root = ) I can't use rename() to move something out of the doc root and I can't use fwrite() to create a file outside of it either. Just to verify, I exec'd whoami from a php file and it echo'd

Git CHMOD post-receive hook

為{幸葍}努か 提交于 2019-12-11 06:20:55
问题 I'm using a bare remote repository on my webserver with a post-receive hook that will automatically push my files in the public_html directory. The problem is, I'm using codeigniter and the index.php file has to be chmod 755. I changed it on the server with filezilla, but after every push the index.php file gets set to 644, which results in an internal server error. This happens even when the index.php isn't changed or stashed.. I've searched for a solution, but so far without luck.. Could