By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,408 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,408 IT Pros & Developers. It's quick & easy.

move_uploaded_file, fileowner, chown etc.

P: n/a
I have a form handler script that creates a new folder for the files sent in
the form. Move_uploaded_file transfers then puts those files there.

But problem is that apache becomes automaticly owner of folder and files, so
later I cannot delete/rename/transfer those files trough winscp. Only load
them if permissions are set ok.

Chown doesn't work, because only superuser can change file's owner. What can
I do? Make 24 h agreement with superuser? Become superuser? Now i fell more
like superloser. I create files but i cannot delete them.

--
Perttu Pulkkinen
www.risteys.net
www.onnenliinat.com
www.palvelukaupunki.fi
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
*** Perttu Pulkkinen wrote/escribió (Thu, 02 Jun 2005 09:08:02 GMT):
Chown doesn't work, because only superuser can change file's owner. What can
I do?


Try changing the group with chgrp() and giving rights to the group. In many
Linux distros user's main group is a group named after the username that is
created automatically. That's it, user john belongs to group john.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2

P: n/a
"Alvaro G Vicario" wrote:
*** Perttu Pulkkinen wrote/escribió (Thu, 02 Jun 2005 09:08:02 GMT):
Chown doesn't work, because only superuser can change file's owner.
Try changing the group with chgrp() and giving rights to the group. In many Linux distros user's main group is a group named after the username that is created automatically. That's it, user john belongs to group john.


Chgrp doesn't work either, because only superuser can change file's group.
Jul 17 '05 #3

P: n/a
Perttu Pulkkinen wrote:
"Alvaro G Vicario" wrote:
*** Perttu Pulkkinen wrote/escribió (Thu, 02 Jun 2005 09:08:02 GMT):
> Chown doesn't work, because only superuser can change file's owner.

Try changing the group with chgrp() and giving rights to the group. In

many
Linux distros user's main group is a group named after the username that

is
created automatically. That's it, user john belongs to group john.


Chgrp doesn't work either, because only superuser can change file's group.


It does work. The apache user must be in the group.

So if user John is in group "John", and you want John to be able to
manipulate files uploaded by apache, then put apache into that group also.
Then apache will be able to chgrp its own files to group John.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Jul 17 '05 #4

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Try using FTP

Something like...

$id_con = ftp_connect("localhost");
$resultado_login =
ftp_login($id_con, "ftp_user", "ftp_pass");
if ((!$id_con) || (!$resultado_login)) return 0;

if(!file_exists("my_folder"))
ftp_mkdir($id_con,"/_other_/_ftp_folders/my_folder");
$carga = ftp_put($id_con,
/_other_/_ftp_folders/my_folder/myfile,
$_FILES["myfile"]['tmp_name'], FTP_BINARY);
if(!$carga) return 0;
else return 1;
ftp_close($id_con);

This is what I do to avoid the problem ^^

Greets.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCn1YDlrI0xkZFpzMRAlA3AKCuNDZdmOnAuEOIx4K33h WvEmJDhACfdUje
wgPpTlbeLoyMD8IWVHlmRo4=
=TrhR
-----END PGP SIGNATURE-----
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.