Jump to content
xisto Community
tansqrx

How To Change The Owner Of A File?

Recommended Posts

I have been using phpFormGenerator which is included in Fantastico under the cPanel. The script works OK but I have encountered another problem. When I send attachments they are stored on the server and I canĂ¢t delete them. The problem appears to be that phpFormGenerator creates the file with no owner.

-rw-r--r--  1 nobody nobody 420457 Dec  7 00:41 12_41_25_update.txt

I have SSHed into the server and tried to delete them manually.

-jailshell-3.00$ rm 12_41_25_update.txtrm: remove write-protected regular file `12_41_25_update.txt'? yrm: cannot remove `12_41_25_update.txt': Permission denied

I next tried to chmod the files

-jailshell-3.00$ chmod 777 12_41_25_update.txtchmod: changing permissions of `12_41_25_update.txt': Operation not permitted

And last but not least I tried to take ownership

-jailshell-3.00$ chown ******* 12_41_25_update.txtchown: changing ownership of `12_41_25_update.txt': Operation not permitted

Any suggestions?

Share this post


Link to post
Share on other sites

Some months ago i have the same trouble with phpFormGenerator and with phpGenie at other sites i mantain and never found the solution, so, all the problematic files and directories remain at that servers, i jUst read the solution and try the cleanup script, it seems to work but nothing happens and also the script dont show anything.It is very strange, because in one of the servers with trouble i can chmod 777 the directory but i cant delete it after that.Best regards,

Share this post


Link to post
Share on other sites

Some months ago i have the same trouble with phpFormGenerator and with phpGenie at other sites i mantain and never found the solution, so, all the problematic files and directories remain at that servers, i jUst read the solution and try the cleanup script, it seems to work but nothing happens and also the script dont show anything.
It is very strange, because in one of the servers with trouble i can chmod 777 the directory but i cant delete it after that.

Best regards,

If nothing is shown after you run the script, then it didn't work!

The path must be correct!
/home/username/public_html/directory/file.txt

As for the directory that you can chmod to 777 but can't delete, you have to have write permission in the parent directory as well so chmod the parent to 777 as well.

SSH isn't disabled, just not offered. It has been found that shell access is far more trouble to deal with than it is worth!

Anyhow, if you really want to chown a file or directory, you have to write a script to do it in the file system. Since the server owns the entity, only the server can change the owner of that entity! The server only performs tasks when it is directed to do so by a script. But if you write a script and it is wrong, then the file could be owned someone other than you ar or the server and then there isn't any possibility of changing it again without an system admin to help.This would be so much easier if everything use FTP instead of the file system!

vujsa

Share this post


Link to post
Share on other sites

Some months ago i have the same trouble with phpFormGenerator and with phpGenie at other sites i mantain and never found the solution, so, all the problematic files and directories remain at that servers, i jUst read the solution and try the cleanup script, it seems to work but nothing happens and also the script dont show anything.
It is very strange, because in one of the servers with trouble i can chmod 777 the directory but i cant delete it after that.

Best regards,


i solved that by using a filemanager i installed.. of course you need to make it secure..
the control panel file manager belongs to cpanel user, i guess.. and it cannot erase that rouge file.

using a filemanager you have installed means that you are telling apache to clean itself up.. since it is apache that put it there.. it is also owned by apache.

it worked on my side..

---

this situation also occured in the paid hostings.. aside from the ftp rouge temp file when i get those random ftp timeouts.

it is bother some but i think it is ok.. i already have a use for this "feature"

Share this post


Link to post
Share on other sites

Cleanup.php worked the first time. I have already deleted the file but the original post mentioned leaving it there but password protected. How would one go about doing this?

Well, the easiest way to password protect a directory is to use the Web Protect feature in cPanel.

Just goto cPanel > Site Management > Web Protect and select the directory that you want to protect.

the directories are a little tricky to navigate in this program but you'll get the hang of it. It is like the filemanager where clicking the folder icon will take you into the folder but the folder name will select that folder.

Generally speaking, any folder inside of a protected folder will require the same password to enter.
You can add multiple users to this folder and ech folder can have a different password and/or user.

It is possible to do all of this manually but if you don't get it right, there could be a hole in your security. With a script, you could even use this as your primary means of user management in restriccted areas but that usually isn't done anymore.

For more information, look into password protection using .htaccess and .htpasswd.

Keep in mind that this only restricts http acces to the folder. FTP access is not restricted so it is possible for someone to access your ftp account and either remove the restriction or move your sensitive script to a non-restricted folder for their use.

vujsa

Share this post


Link to post
Share on other sites

i solved that by using a filemanager i installed.. of course you need to make it secure.. the control panel file manager belongs to cpanel user, i guess.. and it cannot erase that rouge file.

using a filemanager you have installed means that you are telling apache to clean itself up.. since it is apache that put it there.. it is also owned by apache.

it worked on my side..

---

this situation also occured in the paid hostings.. aside from the ftp rouge temp file when i get those random ftp timeouts.

it is bother some but i think it is ok.. i already have a use for this "feature"

Following your suggestion i install a filemanager and finally i could solve the problem and be able to delete all the problematic directories and files. The reason i could not be able to do it before was because the ftp program that i use don't show some htaccess files that were left behind, i dont know why it happens because with this same ftp program i can see this files in other sites.

Best regards,

Share this post


Link to post
Share on other sites

nice to know that it helped.. =)

yeah thanks again and i think that help and be helped by people is one of the best things of this forum, specially because ALWAYS ARE CORRECT ;).

BTW, if someone needs the php filemanager i installed to resolve this problem please let me know to send it by mail.

Best regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.