Web Hosting Talk







View Full Version : Tar and Permission


Fremont Servers
09-10-2001, 03:45 PM
Hello,

I came up with a problem today.

I used the below command to tar up every files in a directory, so I could transfer it to another account without altering the permissions.

tar -cvzf xxx.tgz *

Then I "cp" the xxx.tgx to another account, and used the below command.

tar -xvzf xxx.tgz

Everything works fine, except for one thing.
When I used an ftp client software (CuteFTP), and tried to change the permission of the files & directories from the tar, it wouldn't let me. I uploaded a cgi file on my pc to the account, and tried to change the permission, and it worked.

This is not very practical.
Does anyone know how to solve this problem without re-upload through CuteFTP, but through the command line?

jtan15
09-10-2001, 04:04 PM
It sounds like the owner of the files wasn't updated. Run this command:

chown -R NEW_USERNAME /path/to/files

This will give the NEW_USERNAME permission to delete/alter files (including changing the permissions on the files).

Fremont Servers
09-10-2001, 04:23 PM
Thanks Vincent Paglione,

You nailed the problem.

The owner of the files was from the old account.
The command 'chown -R NEW_USERNAME /path/to/files' has changed the owner of the files to the new account.

Thank you very much! :D

jtan15
09-10-2001, 06:41 PM
No problem. Glad I could help. :)

remarkable
09-10-2001, 07:09 PM
To keep permissions when you restore make sure you use the -p switch when you create the tar file.

'man tar'