Solved

Default permission creating a FTP Folder

Posted on 2008-06-25
7
2,009 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

726 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