Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Mar 26 '11 at 2:21

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

add comment

3 Answers

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
add comment

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
add comment

rsync -avz is your friend ...

share|improve this answer
add comment

Your Answer

 
discard

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