Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Mar 26 '11 at 2:21

This question came from our site for professional and enthusiast programmers.

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
share|improve this answer

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

share|improve this answer
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 '11 at 4:45
Is there nay other way of doing through linux command line – John Mar 24 '11 at 5:24
This is all I know :-( – Kumar Mar 24 '11 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 '11 at 3:28

rsync -avz is your friend ...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.