1

I have come across problems many times and still have not found a solution.

I have websites running php joomla on one linux VPS with centos. Now as I install new extensions, there are some files and folders created within the website. These files or folders have permissions of either apache or whatever.

I make a tar ball using the -p flag so that permissions stay there, but the problem is that the owner of the files in the original Linux does not exist in the new Linux, so the same cipts now can't edit its own settings because now the owner is changed.

I have to manually change the permission of every folder to 777 to make them work.

How can I fix this problem?

3 Answers 3

3

Rather than opening up your entire web site to modifications from everyone and all programs on your VPS, it'd be much better to fix the permissions issues.

cd /path/to/webroot/ ; chown -R <username>:<groupname> .

Replace the <username> with whatever user should own the files. Same with <groupname>. It should not be the Apache user -- if there is a flaw in Apache or the programs you run through Apache, you don't want your data files to be writable.

Once you're done, undo your 777 modification:

find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644
0

use cp -pr /source/path/to/folder /destination/path/to/folder
and scp -pr user@hostname:/source/path/to/folder user@hostname:/destination/path/to/folder

4
  • argh!!! didnt read the question fully, answered only on the basis of title, I think cPanel has option of backing up data and restoring it on destination exactly same way
    – Kumar
    Mar 24, 2011 at 4:45
  • Is there nay other way of doing through linux command line
    – John
    Mar 24, 2011 at 5:24
  • This is all I know :-(
    – Kumar
    Mar 24, 2011 at 6:08
  • Another way would be "rsync -av --progress /source/path/to/folder /destination/path/to/folder" or "rsync -av --progress /source/path/to/folder user@hostname:/destination/path/to/folder"
    – rthomson
    Mar 26, 2011 at 3:28
0

rsync -avz is your friend ...

You must log in to answer this question.