Chmod Mkdir And File Permissions..
I'm trying to create directories and move files with the right permissions. When I make a dir using mkdir I'm setting the permission to 777 to my folder variable $t2 below,
but when I check the chmod it's 755? When I copy files over to this folder the file permission are set to 644 and I can't even get rid of them on the server because it won't allow me to delete them. Is there anyway to set permissions to a file as you're using the copy function? Code:
View Complete Forum Thread with Replies
Related Forum Messages:
CHMOD File Permissions
i have a few question about file permissions. which is the best way to set a permission to a mp3 tha ti can play on the website, but if anyone try to get it from the directory they wont be able to? like if i am playing thissong.mp3 and someone went to the directory to try and get the file music/songs/thissong.mp3 they would get some kind of error. also for folders that don't have a index file. which permission would be the bes tinstead of creating a number of index for each, but not give a use permusic to see the context if the go to mydirectory/functions/ .
View Replies !
Mkdir CHMOD Incorrect
I am trying to make some directories with specified CHMOD but it doesn't set the right CHMOD. When directories are created they have CHMOD 755. What can be the cause of this?PHP Code: $dir = $_SERVER['DOCUMENT_ROOT'].'/_lib/photos/'.$id; if(!is_dir($dir)){ mkdir($dir, 0777); mkdir($dir.'/websize', 0777); mkdir($dir.'/thumbsize', 0777); }
View Replies !
Mkdir Permissions
I have a new server and I have my files up there. The files are in /var/www/html/. In this directory I have another directory that I created called "users". I am unable to figure out how to set permissions on this directory, and what those permissions should be. I am using ShieldHost. When there is a new user, and he enters his desired name and password, as part of the process I want to create a small directory tree under "users" with the username as the top level. I get that I don't have permission to do that with the mkdir in the code. The line of code is: mkdir($_SESSION['UserRoot'] . $ss_username, 0755);
View Replies !
Mkdir Permissions Issues...
I was trying to write a function to to autmatically create a specific directory path... It was functionalized so that it was passed a long directory (string) like: /var/html/www/whatever/whomever/however/ It works just great, too. The problem is that I have been running into permissions issues. Via the web ok, but ftp not ok. Basically once this is created by the web server it can't be changed manually through ftp... The reason web server's group is nothing, ftp's group is some_group... Not the same.... I have used different combinations of umask (000) & mkdir's (0777) permissions, but I do not want to risk security on the web server... An interesting dilemma security vs automation? any thoughts? I have also considered using ftp functions in php.
View Replies !
Mkdir Setting Permissions...
I've used this code for awhile now; mkdir($path, 0700); But now instead of setting the folder permissions to 700 they are being set to 600... Any ideas on what could cause this? I had no problems for a long time and noticed recently when new users are added their custom pic folder is set to 600 making it worthless for anything.
View Replies !
Change Permissions To Allow Mkdir() But What About Security
When users register with my site I want to create a directory where I can store certain user files. This gives the user the ability to have a 'neat' domain name like URL instead of something like URL I have been successful using the mkdir() function in my scripts but I need to give write permissions to the URL directory as has been suggested in all the submissions to this forum. Is it safe giving write permissions to the site's main directory? If not is there another way to create a sub-directory without giving up any security?
View Replies !
Mkdir, Directory Permissions Denied
I want to create a directory tree on the server with the user's name as the top level for that user. I want to create this directory, and two subdirectories, when the user signs up. The problem I am having is with permissions. I get: Warning: mkdir(11june1): Permission denied in /home/virtual/site127/fst/var/www/html/ssUserAdd.php on line 87 How do I have the user's action result in the directories being created, but not have the user have access to anything except in that tree through the interface?
View Replies !
Chmod Permissions Set
Trying to find out why anytime I create a new file on our server I must set the chmod permissions for the file in order for it to work in apache/php. I must set "chmod a+rx newfilename.php" or else when I attempt to view the page in a browser I get the following error message in our php error log. PHP Warning: Unknown(newfilename.php): failed to open stream: Permission denied in Unknown on line 0 PHP Warning: (null)(): Failed opening 'newfilename.php' for inclusion (include_path='.:') in Unknown on line 0 Must I change something in php.ini?
View Replies !
Chmod() / Permissions Problem
I'm writing a script to backup my mysql database on a regular basis (idea of script is it gets called every time a user visits the homepage - if timestamp in db is older than now() - $interval then a mysqldump of all tables in db is performed using mysqldump via the exec() function). The part I'm stuck with is creating a directory with the correct permissions so that I can write the output of mysqldump to a file within that directory. The function which is called if a dump is required is below - the problem is explained in more detail after the code:
View Replies !
Mkdir Warning: MkDir Failed (No Such File Or Directory)
everytime i use mkdir to create a directory it works with a relative path like ../this/path/folder but it seems to quit on me if i use /home/user/this/path/folder for some odd reason, it is giving me this error Warning: MkDir failed (No such file or directory) in c:apachehtdocsmyscriptadd_person.php on line 12 p.s. YES i have permissions to write on this drive, it works fine with a relative path, just not with an absolute path
View Replies !
Is_writable Problem - Set Write Permissions? With Chmod?
I have a problem fixing an upload script by implementing the opensource project webcollab. By setting the upload directory to a certain folder in the config.php file, the whole thing should work, but it does not. It says that write permission for the folder should be set properly. I assume the folder is correct(heej i am not such a big idiot ), so the problem is the write permissions. I assume it is not in the script, since the version of the project is stable. Question: How do I set these write permissions? With chmod? Or is this more a kind of thing that the server admin should set?
View Replies !
Mkdir() How Do I Automatically Make A Index File And A Css File
using mkdir() how do i automatically make a index file and a css file. what i really mean is once the directory has been made how do i make it so i have a index and css file there, its just because im making a forum hosting service and i need all the files automatically set up in the directory. how can i do this?
View Replies !
MkDir Failed (No Such File Or Directory)
I'm trying to create directories from a variable but all i get is MkDir failed (No such file or directory) in blah blah blah line 30... i tried different modes (ie. 666/777/757) but always get the same error. the directories must be created in the same folder as the php file as subdirectory. PHP Code:
View Replies !
Mkdir - Copy Function And Fopen To Make A New File
Ive got a script where people can sign up and a folder is created with their username as the name of it. I also want to copy files to that directory using the same script but everything Ive tried doesnt work. Ive tried using the copy function and also fopen to make a new file but none of them have worked. Code:
View Replies !
Can't CHMOD 775 A File!
I'm using Windows XP Professional and have no FTP installed. Instead, I use Command Promt. I need to CHMOD a PHP file, so I type "CHMOD 775 file-path",but get "'CHMOD'is not recognized as an internal or external command,operable program or batch file"!Is this because I spelled it wrong?Or is it the computer's problem?
View Replies !
Detecting Chmod On A File
is there a way to test a file for it's current CHMOD settings? i want to make a script that checks all of my sites for security threats and i need to detect all 777 files/folders.
View Replies !
CHMOD And File Writing
I made a small script that logs my blog's visitors. Here it is: $file = fopen("log.txt", "a"); fputs ($file, "$ip, $host "); fclose ($file); I CHMODed the file log.txt to 0777 and it's working. But is it correct? I mean which CHMOD do I have to set for log.txt.
View Replies !
Retrieve The CHMOD Of A File Via PHP
Just currently having some problems, I am wanting to retrieve the CHMOD of a file via PHP but don't know how to. All the code I found is just to change the CHMOD and not to retrieve it in order to show on a page.
View Replies !
How Do I Chmod A File Upload
I need to change the file permissions on file uploads through my PHP form from 600 to 644 so they can be viewed in a website. what is the correct way to do this? My current code snippet looks like: $upload_dir = "uploads/"; $filename = $upload_dir.$_FILES['upload']['name']; chmod($filename, 0644); if(move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/{$_FILES['upload']['name']}")) { etc...
View Replies !
File Upload Problem, Chmod
i'm having a problem with file permissions of upload, they appear to be being set to only readable by the administrator, so anyone browsing the site gets a 403 forbidden error when they try and view the image. I've tried adding the following line: - chmod($uploadfile, 444); and also a few variations on it but to no avail. Script below: - if($_FILES['imageloc']['name'] == '') { echo 'The Small image remains the same or default<br />' } elseif($_FILES['imageloc']['size'] > $MAX_FILE_SIZE) { echo 'The small image you selected is too large<br />' } elseif(!getimagesize($_FILES['imageloc']['tmp_name'])) { echo 'The small image you selected is not a valid image file<br />' } else { $uploaddir = '/web/html/images/' // remember the trailing slash! $uploadfile = $uploaddir. $_FILES['imageloc']['name']; chmod($uploadfile, 444); if(move_uploaded_file($_FILES['imageloc']['tmp_name'], $uploadfile)) { echo 'Upload file success!' } else { echo 'There was a problem uploading your file.<br />' print_r($_FILES); }
View Replies !
Directories, CHMOD, And File Uploads
1) Is the only way that doesn't involve Databases to upload files is to CHMOD a directory to 777? 2) What are the risks of CHMODDING a directory to 777? 3) What are the risks of CHMODDING a .txt file to 777? 4) How can I find the name of every .txt file in a directory?
View Replies !
Does Chmod 666 Protect Against Uploaded File Attacks?
Suppose I let users login into my control panel and upload files. They could upload PHP or Python or Perl scripts and take over the web server. If the PHP code that handles the uploads automatically chmods them to 666, the files can not be executed. Does that make them safe?
View Replies !
Creating/writing To Text File And CHMOD
When I try to create a file with fopen(xxx.txt, w) I only receive an error message. Also when trying to append text to an existing file. I then chmoded the existing file to rw-rw-rw and it works now, but is this the right permission ? And how can I create a new file ?
View Replies !
Forced To Chmod 777 Directories For File Upload
I'm in the process of switching a client's site to a new host. Host 1 uses Apache 2.0x, php 5.2, mysql 5. I have the pertinent directories' permissions set to 751 and it works great. When I moved the site to the new host (using Apache 2.2x, php 5.2, mysql 5), only 777 allows the users to upload files to the same directories. I won't make this site live until I can use a more strict set of permissions. Any idea why anything but 777 won't work on the new server?
View Replies !
File Permissions
Im in the process of creating a web based frontend for a program called ASK (Active Spam Killer - http://a-s-k.sourceforge.net) and am currently running into a problem. Currently there is a perl based web front end, but it lacks functionality, and is rather bland, although it does work, and it works without changing any file permissions. The problem im running into is that PHP requires me to make changes to file permissions (ASK files are located OUTSIDE of the web tree) which might end up causing problems as far as security and privacy of email. Has anyone come to any reasonable answer for this type of problem as im sure its a issue for other programs people write.
View Replies !
File Permissions....
I've read the stuff concerning writing to a text file and the related file permission issues on this forum.I have a script that does just that, it takes user-entered data from a Web Form and dumps it to a text file on a server. This works fine on my private server, but is giving me the error...."Could not open stream.Permission denied on Line..." on the company server...The Company machine uses Windows XP. I've tried talking to the System Administrator regarding the Permissions,but he says that giving READ/WRITE/EXECUTE Permissions could create Security Issues. I have been told that previously,a script written in ASP had been used that did exactly the same thing i.e writing to the text file, but there were no File Permissions needed to be set!
View Replies !
Problem With File Permissions : PHP / FTP
My php-script makes directories and puts files in it. But via FTP'ing, I can't delete those files anymore. Also, I need to put a whole bunch of existing files into these, 'made-by-php' directories, and that seems impossible by means of FTP. I get an 'access denied' error every time.
View Replies !
File Permissions After Copy()
This function basically creates a new dir in a determined location and copies the files from an established dir to the new dir. It copies the files and creates the folder ok, bit it sets the file permissons to 755 for the new folder and file contents. I then get a 550 error if I try to delete or chmod them. Any suggestions? I get permission errors in the script if I use the chgrp and chmod functions also. PHP Code:
View Replies !
File Permissions In Win98
I just wanted to know if there was any way I could change my file permissions so I can use the fopen function in windows 98 using Apache and PHP 4.04???? I know how to do it for Linux but I need it for Win 98.
View Replies !
Change File Permissions
i'm trying to create a file management tool online using php. Everytime i copy or create files or folders though it assigns ownership of the new files or folders to the apache id. i tried using backticks, exec, shell_exec and the php shell commands. php safe mode is off. i can create the files and folders using shell commands and have tried to change ownership using chown but that doesn't seem to do anything. any insight can help. the goal is to be able to create these files with the same admin user ownership as all the other files on the site.
View Replies !
File/folder Permissions
I have an upload function that uploads images into a folder. The folder is set to 777. However when I upload an image file to the folder, the file uploaded is set to 600. Therefore it wont appear on web. I'm not sure why this is doing this for?? Im using the php function move_uploaded_file to upload the file.
View Replies !
File Write Permissions
I'm trying to get an open source PHP app working for my company. It's giving me the following custom error: FreeMED was unable to create a file to record the healthy status of the system. The FreeMED directory should be owned by the user that the webserver is running as... Usually this is 'apache'. You can also fix this by giving universal write access to the home directory of FreeMED. But that is not advisable from a security standpoint. I've narrowed it down to the line of PHP that's breaking it here: $test = CreateObject('FreeMED.FreeMEDSelfTest'); As far as I can tell, I've made the directory it's using as open as possible and it's still giving me that error. The owner is apache (user and group) and the permissions are (temporarily) set at 0777 (universal read/write). Is there some PHP or Apache configuration that needs changed to allow PHP this kind of permission?
View Replies !
File Permissions Windows
i am using the LOAD DATA INFILE to load from a txt file. Although it works fine with the MySQL command it does NOT work with Script...does anybody know why?
View Replies !
File Permissions On Upload
I am uploading picture. This is part of the code if(!move_uploaded_file($_FILES['fullSizePic'.$propId.$i]['tmp_name'], '../images/properties/'.$imageName) ){ chmod('../images/properties/' . $imageName , 0777); } The file uploads and moves into the properties folder. That folder's chmod is 777, but the file's chmod is only 600 making it unreadable by the server. I try to chmod it with php (as you can see above) and it doesn't work.
View Replies !
Not Enough Permissions To Delete A File
I want to delete a file using unlink() function. I'm getting a warning that says that I have no permissions to do that. I suppose that is because the file I'm trying to delete is under the root directory path. I searched the forum about deleting files but found nothing alike my problem...
View Replies !
Upload File Permissions Problem
I've moved an existing site (which I didn't write) from a apache/php/mysql host under windows to a linux apache/php/mysql host. I've sorted out most problems except one. There is an upload function on the site, which uploads files via POST to temp folder and then moves it into a folder on the host using php function move_uploaded_file. Under windows this works fine but on the linux host the uploaded file is created with 600 permissions so it cannot be accessed later by site visitors. The folder it is uploaded into has 755 permissions. Is there a way of setting the default file permissions so each uploaded file can be set to say 644 or do I need to chmod each file after upload?
View Replies !
File Permissions Of PHP Session Files
I noticed that the file permissions (unix) of the PHP session files have only read and write permissions for the Apache process (600 or rw- --- ---). Does anyone have any idea where this permission is set ? I can't find any umask or chmod settings for it in the php.ini file. Can't find anything in the httpd.conf either. Is it set in the PHP code that implements session_start()?
View Replies !
Creating A File, Uploading, And Permissions
I'm using php4 and i want to check for a file, if it doesn't exist it should be created. My problem is i have to create it with specific permissions specifically 666 so that the script can then write to it. I don't have ftp access. I'm also looking for any tutorials, recent ones, using php4 for creating file upload areas, i'm trying to make one of those as well.
View Replies !
File And Directory Permissions For PHP Application
I make the directory 0777 and then write the file then i make the file i tried a few but they keep from being read im sure the file is ok i think i can handdle file permissions but i think its directory permissions im having a prob with. Its an image file i write it and then need to use it so make the directory 0777 and then write the file and then what to the file and what to the directory ? i am using php ftp() but if anyone knows any differences with php chmod() then please tell me apart from that i do a 777 righth now and leave it at that. what should i being to the directory and file after to make it secure because i dont whant people tampering with them ? OH AND THIS PROBS ON TH MAC OSX 10.4 TIGER my chmoding works fine on linux the way it is 0777 and then a 655 + somtimes i play with the permissions of the directory throgh the os GUI or the shell and i got it to tell me i dont have permissions in the OS but in PHP its ok is this coz PHP got ownership of it when i messed with the addtional BIT.
View Replies !
File Permissions Denied Error
i'm using the following code to create a file. PHP Code: $fn = "file.php"; $FileHandle = fopen($fn, 'w+') or die("can't open file"); $stringData = "Something"; fwrite($FileHandle, $stringData); fclose($FileHandle); when i check the file properties i can see that the file's permission is set to 644 so when i use the following code to delete it i get a permission denied error. PHP Code: $myFile = "file.php"; $fh = fopen($myFile, 'w') or die("can't open file"); fclose($fh); $myFile = "$file.php"; unlink($myFile); what shall i do to set the permission to 777 when creating the file?
View Replies !
|