?
Solved

Default permission creating a FTP Folder

Posted on 2008-06-25
7
Medium Priority
?
2,015 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This is the first one of a series of articles I’ll be writing to address technical issues that are always referred to as network problems. The network boundaries have changed, therefore having an understanding of how each piece in the network  puzzl…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

770 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