chmod

PHP File Permissions... getting it "write"?

Hi there, I am trying to write an install script for a system I have been working on. The script copies some default files from one location to another, and creates various folders for them. I have this bit working a treat, but the only problem is that when I login via FTP, I can't edit, or delete the files that PHP has moved for me. ...

How can I audit all chmod and chgrp commands?

Corporate security policies are starting to require low level event logging. For example, file access permission changes. One solution is to use SELinux but our knowledge of this is sparse at best. Another is to replace the command with a proxy which performs auditing (this sucks though). Any ideas? ...

Recursive chmod in ruby on mac OS X?

I need to delete an application (MyApp.app), which has read only permissions in all its enclosed folders. Before I delete it, I should change the permissions on all enclosed files/directories to 0644. How do I do this recursively? I've tried begin; FileUtils.chmod(0644, '#{config.appPath}'); rescue; end begin; FileUtils.rm_r('#{config....

How to chmod of subdirectories of a provided path (BASH)

I need a script that takes a single command line argument that is a directory path. The script should check the argument to determine if it is in fact a directory. If it is a directory, then the script should change the protection mode of any subdirectories located in it to 600. If the argument is not a directory, then an appropriate me...

How do I make git ignore mode changes (chmod)?

I have a project in which I have to change the mode of files (chmod) to 777 while developing, but which should not change in the main repo. git picks up on chmod -R 777 . and marks all files as changed. Is there a way to make git ignore mode changes that have been made to files? ...

Warning:chmod() [function.chmod]: Operation not permitted

When i use chmod() function to change permission on run time,it give me below message . Warning: chmod() [function.chmod]: Operation not permitted in /home/loud/public_html/readalbum.php How i can remove this error and make working of chmod function ...

How do I make git accept mode changes without accepting all text changes?

I've got the opposite problem from "How do I make git ignore mode changes (chmod)?" I've got a file that I've changed executable permission on, but there are also some text changes, and I want to commit the former but not the latter. Is this possible with git? (Actually, I've made some text changes I want to commit along with the execut...

set file permissions in header before forced download in php?

Im generating a file to present to the user for download, but the server isnt letting me open it, because it needs to have permissions of 777 before it can do so. Here is my code $fh = fopen("$name", 'w') or die("can't open file"); fwrite($fh, $data); fclose($fh); header("Cache-Control: public"); header("Content-Description: File Tran...

cleartool protect -chmod 770 <vob-tag-name> ERROR

This command does not work: cleartool protect -chmod 770 <vob-tag-name> i get the following error: cleartool> protect -chmod 770 vob-tag-name cleartool: Error: Unable to access "vob-tag-name": ClearCase object not found. The VOB tag is valid and points to the correct VOB location. What am I doing wrong? HELP! Thank you! ...

How best to implement CHMOD type roles for a ASP.NET web application

Currently in my Web application I have simple USER_LEVEL field against the user credentials e.g Normal Authoriser Admin As we get further into development I see more ambiguity coming into these roles and expanding the types that are there, so in theory an Admin role would essentially give that person 777 access to everything (not nec...

Python script runs via apache when permissions are 755 but gives Error 500 when 777?

I uploaded a basic python script to my shared hosting at Dreamhost, and changed the permissions to 777. It ran fine from the shell (via SSH) but would display a 'Server Error' when called from the browser. In the error.log, the error was 'Premature end of script headers'. I wrote to DreamHost, who (surprisingly quickly) replied by chan...

Correct owner/group/permissions for Apache 2 site files/folders under Mac OS X (10.6)?

It's hard to find Mac-specific answers to this question on the web, so I'm hoping someone out there can put this one to rest for me? My permissions are screwed up on my sites and I'm not sure how to fix them without just slamming a recursive 777 on everything which is quite obviously incorrect. Thanks! ...

PHP and CHMOD question

Hi, I want my PHP software to be able to auto update. For this to work, I need PHP to be able to write into files both existing and non-existing (create). Will it always work if I just CHMOD the target files to be 0777 and then write into it? Or does the PHP/Apache/wtvr process need to be the owner of the file? Sometimes when people up...

Recursive mkdir() and chmod()?

When using mkdir() with the recursive flag set to true do all the created directories get the specified chmod or just the last one? For example: mkdir('/doesnotExist1/doesnotExist2/doesnotExist3/', 0755, true); Will the newly created directories /doesnotExist1/ and /doesnotExist1/doesnotExist2/ also get the same chmod as /doesnotExist...

Mixed ftp ssh permission problem

Hi, I'm running a webserver and I've setup two groups. One with just me, and another with me and a collaborator. I've chmodded to 755 my htdocs folder and I gave a specifically "upload" dir the group shared with my collab. So now my collab (via sym link) is able to upload some files via sftp, but he can also traversing all the directorie...

Filesystem operations don't work from my PHP script; do I need to chmod something?

I am having some permissions problems with mkdir in PHP. I am trying to simply move some files around (and create a folder to put them in), but I am getting this error: mkdir() [function.mkdir]: Permission denied in On my old site, I had my folders set to 755 and things seemed to work fine. It seems like the only time I can get mkdir ...

Graffiti CMS - do I really need to 777 the entire install?

I am trying to install GraffitiCMS on my rackspacecloud account. It is mostly working, but it seems I pretty much have to set everything to 777 to get it to work? Is that even reasonable? While I am not security expert, it seems that having to basically leave the door wide open to everyone in the world is not a great solution. Am I mis...

C: The remove function removes all files?

I am using something like this: char *file; file = (char *)malloc(BUFSIZE * sizeof(char)); printf("Enter the filename:"); scanf("%s", file); if(remove(file)) { printf("Error while removing"); } I created two files: touch filetobedeleted1.txt chmod 777 filetobedeleted1.txt touch filetobedeleted2.txt chmod 444 filetobedeleted2.txt ...

In a PHP / Apache / Linux context, why exactly is chmod 777 dangerous?

Inspired by the discussion in this question, a maybe stupid question. We have all been taught that leaving directories or files on Linux-based web hosting with the permission level of 777 is a bad thing, and to give always as little permissions as necessary. I am now curious as to where exactly lies the danger of exploitation, specific...

Chmod, php and imageupload

What is the best practice when it comes to image upload using PHP? How should I handle the chmod settings? Example; I have a dir called /image/ where i want to upload all my images. Should I set this dir to chmod 777 and leave it like that? Or should i change chmod on that folder via PHP each time I need to upload a image. What is bes...