Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Default permission creating a FTP Folder

Posted on 2008-06-25
7
Medium Priority
?
2,019 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
Industry Leaders: 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

618 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