Only allowing chmod 777 for file upload folder

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Only allowing chmod 777 for file upload folder
# 1  
Old 10-03-2010
Only allowing chmod 777 for file upload folder

Hey everyone. I have 2 different linux servers (each one is through a different web hosting company). On both servers I have the exact same PHP file upload script that allows users to upload a file or image to the server (everything on both servers is identical).

On server #1 the "attachments" directory (which is where the files are uploaded to), I have the permissions set to chmod 755 and the files are successfully uploaded to the server (into the attachments folder).

HOWEVER, on server #2 for some reason, the files will not upload into the "attachments" directory unless I put the permissions to chmod 777 (chmod 755 will not work on server #2).

Does anyone know any possible reasons as to why server #2 will not allow file uploads with chmod 755?

# 2  
Old 10-03-2010
More-than-like you have a permission problem related to the userid (UID) of the process running the web server and the userid (UID) and/or groupid (UID) of the directory.
# 3  
Old 10-03-2010
Thanks for the response. I'm not really sure how to remedy that permission issue, so if I was to somehow not allow that particular directory (the "attachments" directory chmod 777) to run any "scripts", would that make it more secure?
# 4  
Old 10-03-2010
When you upload a file via a web server, generally, the user id of the process writing the file is the user id of the web server.

Do you know the UID of your web server process?

You need to start there. What is it?

Then look at the user and group ids of the directory where the file is uploaded, as well as the permissions of the directory.

If you have to open the directory up to 777 for the web server to write to it, that usually means the directory is not owned by the web server (process), or group (of course), depending on how things are set up.

What are these users, groups and permissions?

These are the basics you need to look at (nothing very complex).
# 5  
Old 10-03-2010
Here is how the "heiarchy" is: directory is chmod 715. When I click into that folder, the "docs" directory is chmod 755. When I click into that folder, all other directory folders in there are chmod 755, except for the "attachments" directory folder that I created (which is chmod 777 so that it works properly). Does this make sense?
# 6  
Old 10-03-2010
Not really.......

Permissions don't make sense in the absence of all the other details like user and group ids.

Your are just wasting your time and our time providing incomplete information.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

chmod -R 777 * in cygwin

Hello, I use windows XP on a small server. Lately I downloaded a software (hydrological computation) which asked me to install as well the software ‘cygwin' (kind of linux in windows environment) and then to perform in cygwin window the command: ‘chmod -R 777 *' in order to give writings... (2 Replies)
Discussion started by: Cedalise
2 Replies

2. Web Development

upload a complete folder

Hi, how can I upload a complete folder (and subfolders) on ftp from terminal ? thanks (3 Replies)
Discussion started by: aneuryzma
3 Replies

3. Cybersecurity

can another user 777 and existing 777 dirctory?

User usrA creates dirA directory and runs chmod 777 on the directory. Can usrB issue another 777 on dirA? It appears the answer is no even if the usrA and usrB are part of the same group. I know this is a rare scenario but I just ran across it and found out that usrB receives an error when... (4 Replies)
Discussion started by: zlek131
4 Replies

4. UNIX for Dummies Questions & Answers

chmod 777 * - oops

I can belive I really did this... chmod 777 /home :eek: I have my /home directory synced to another machine. Can anyone tell me how to get the permissions from back up server /home to production server /home It's important that I dont over write the files on the... (1 Reply)
Discussion started by: shunter63
1 Replies

5. Windows & DOS: Issues & Discussions

How can I upload a zip folder on a unix path from my windows folder?

Hello, I am an amature at UNIX commands and functionality. Please could you all assist me by replying to my below mentioned querry : How can I upload a zip folder on a unix path from my windows folder? Thanks guys Cheers (2 Replies)
Discussion started by: ajit.yadav83
2 Replies

6. Solaris

chmod -R 777 in /usr Solaris 9 = Major Screwup

Hello Everyone: One of our admins here accidently ran chmod -R 777 in the /usr folder on a V440 running Solaris 9. After that no one could run any command and could not login. I fixed most of the things by re-restricting some rights and applying the correct rights. Now there is a problem... (3 Replies)
Discussion started by: muntaser_zaheer
3 Replies

7. UNIX for Dummies Questions & Answers

chmod -R 444 [folder]

using the recursive option for chmod i am trying to make all the folders and subsequent files read only i.e. chmod -R 444 folder when i go to check the folder or contents using any command (cat, ls -l etc..) i get permission denied reply can someone tell me why and how to make folders... (2 Replies)
Discussion started by: rprules
2 Replies

8. UNIX for Dummies Questions & Answers

chmod 777 security risks?

Hello all, I did a considerable search of the forum and didn't find an answer so I'll ask it here. For clarity's sake I'll state that I know just enough about Unix to be Dangerous (I'm an old Clipper, VO, ASM programmer from the 80's.) I would like to install PHP driven CMS program to my... (6 Replies)
Discussion started by: Gary777
6 Replies

9. UNIX for Advanced & Expert Users

Ftp Upload Folder

Hi! I'd like to upload a complete folder with subfolders with put. At the moment I always get the err-msg: aboutme: not a plain file Could anyone help me?? Thanx (3 Replies)
Discussion started by: roberthawke
3 Replies

10. UNIX for Dummies Questions & Answers

chmod 777 on all directories do I do that using the "find" command?

I've got 100 directories that each have 2 directories with in them. Structered like this: /home/domains/domain1/ through to /home/domains/domain100/ and those 2 directories mentioned above are here: /home/domains/domain1/directory1/ /home/domains/domain1/directory2/ through to... (7 Replies)
Discussion started by: Neko
7 Replies
Login or Register to Ask a Question

Featured Tech Videos