?
Solved

Default permission creating a FTP Folder

Posted on 2008-06-25
7
Medium Priority
?
2,023 Views
Last Modified: 2013-12-02
Hello Experts,
  I'm moved a web site from a reseller server to a better VPS server in other company. Everything was ok until this problem with the permissions. In this site, the employees can upload a folder with images via FTP and going to a webpage, the thumbnails are created automatically.
 Now, the problem is the permissions for the imagejpeg:
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'fotos/test00/01.jpg_thmb.jpg' for writing: Permission denied in /home/....
 In the previous site the folder "fotos" (where the images folders are uploaded) and all the images subfolders uploaded had 755 and works fine, but in this server I need 777 to make imagejpeg() write the file. That's not a big problem, but when someone upload a folder it's created with 755 permission and I can't ask the employees to change the permissions everytime they upload a folder. I know, it's a bad system but I developed it some years ago and  they don't wan't to upgrade it yet.

The questions:
  1. Can I make it work with 755 like I used to?

  2.  If I can't, how can I setup the default folder permission to 777 when they are created in the folder "fotos"??

Really appreciate your help and time.
0
Comment
Question by:pablo_take
  • 4
  • 3
7 Comments
 
LVL 8

Expert Comment

by:CoyotesIT
ID: 21867426
Have you tried setting the owner of the folder to the account that is running the apache (i'm assuming) service?

My guess would be that the old server maybe ran under an account that had owner priv on the folder.

Can you paste the detailed permissions for the folder(s)?
0
 

Author Comment

by:pablo_take
ID: 21867691
How can I get the detailed permissions?? The only permissions I know are the ones showing in filezila... 777 or 755...
0
 
LVL 8

Expert Comment

by:CoyotesIT
ID: 21868104
Okay, understood. Wasn't sure if you had ssh access or not.

How are the users uploading files? Are they using seperate accounts? Is it through a PHP uploader or an FTP client?

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pablo_take
ID: 21868178
I have a SSH access.. but don't know how to use it.
They upload the folders through a FTP client. They usually work with windows explorer.
0
 
LVL 8

Expert Comment

by:CoyotesIT
ID: 21868473
If you can access SSH that information would be helpful to me.

You can download an SSH client such as Putty
http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

connect to your server and navigate to the directory you are doing the image work in

type the command

ls -Ral

This will give a recursive directory listing of all the files, permissions, owner, and group

Also, are the users using a single FTP login account, or do they each have their own login?

When you upload files using FTP the owner of the file(s) is the user that uploaded them.

My guess is that the service account that is running your apache service does not have access to write to these directories.

0
 

Author Comment

by:pablo_take
ID: 21869325
"My guess is that the service account that is running your apache service does not have access to write to these directories. "
I knew that from the begining - sorry, but I think we are going away from the problem.

The users use a single FTP account and the permissions restrinct appears when I try to run a php program to write a thumbnail image file.
0
 
LVL 8

Accepted Solution

by:
CoyotesIT earned 2000 total points
ID: 21869531
perhaps the easiest way of getting this working is to just schedule a task that changes the permissions on the images and directories that you need to have open access to, not safe, but it is what you were asking for.


chmod -R 777 /<path_to_images>/

this will make it so that everyone can do whatever they want in these directories.

or give the service account ownership of the files/directories

chown -R apache:apache /<path_to_images>/

which will replace the owner and group of the files to the service account "apache" which may be a different account on your server.

And if you choose either of those options just schedule them through a cron job that takes place when you want it.

Sorry if I'm not understanding your question correctly, but I think we both agree it boils down to permissions. Its getting access to the server and changing the permissions.

If you have one user login for the FTP that is used, then you could create a group add the apache user account and the ftp account to it and give that group permission to the files and folders in your directory and assign 775 permissions to it which would eliminate the need for a repetative task that would need to overwrite the permissions of the files uploaded.

0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Eseutil Hard Recovery is part of exchange tool and ensures Exchange mailbox data recovery when mailbox gets corrupt due to some problem on Exchange server.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question