Solved

Default permission creating a FTP Folder

Posted on 2008-06-25
7
2,007 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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 500 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

861 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