renaming/moving FTP'ed files through web page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JustinK322
Forum Newbie
Posts: 9
Joined: Fri Jul 28, 2006 1:35 pm

renaming/moving FTP'ed files through web page

Post by JustinK322 »

I have a group of files that is uploaded via FTP. Then, I run a script that is accessed through the admin section of my site. This script is supposed to look through the list of files, sort them out, and put them in appropriate directories. My FTP'ed files belong to the the user xxxadmin. Because of this, when I run my web script, I don't have permission to rename/move the file because the web script is running as the user www-data.

Can anyone help me out with a possible solution. I have considered trying to rename/move by connecting to the FTP (in my php script) and renaming/moving them in there, but would rather not have to fumble through code to make this happen. Does anyone have any other ideas or have ran into this before?
JustinK322
Forum Newbie
Posts: 9
Joined: Fri Jul 28, 2006 1:35 pm

Post by JustinK322 »

What about running the php web pages as a user that is not www-data?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Plain answer is - you can't modify the files without the proper permissions. You'll have to either find a way to modify the files as xxxadmin or root. Unless xxxadmin is a root user, it won't be able to change ownership either. Try changing the mode of the files so that anyone can modify the files without needing to be the owner.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply