0

I want to backup all data from a server before I do an Upgrade (Debian). Due to the fact, that there are many user accounts on the server, I thought I just copy all data with scp (scp -r * user@backup-path) as root to my backup disk. The problem now is that, if I do it like that I mess up the permissions of the files.

After coping the files look like this:

drwxrwxrwx 1 root root        496 Mar  8 09:28 .
drwxrwxrwx 1 root root        336 Mar  8 09:27 ..
-rwxrwxrwx 1 root root  154373124 Mar  8 09:24 file-5.cas
-rwxrwxrwx 1 root root  219287728 Mar  8 09:24 copy.tar

If I need to resore the data later this probably is a problem, isn't it?

Is there a better way to do that?

1

You can perform rsync from the source to destination which will solve your permission.

rsync -avzh ssh user@server.example.com:/your/source/ /destination/

You can refer the below link for more details on rsync

How to merge one directory into other?

rsync complication on sync

  • I also thought about that, but what user do I use for my source because my source is the whole /home direcory? – chi86 Mar 8 '16 at 8:55
  • you can perform it by root also. – Mongrel Mar 8 '16 at 9:05
  • and than the permissions are not messed up? Another question, what if something goes wrong and I have to restore everthing? Than there is an empty /home directory on the server and I want to copy the data from the backup-disk, how do I do that? – chi86 Mar 8 '16 at 9:10
  • It won't work I get the following message: Unexpected remote arg: root@server:/home/ rsync error: syntax or usage error (code 1) at main.c(1343) [sender=3.1.2] – chi86 Mar 8 '16 at 9:16
0

Maybe you can use tar, with -p option (preserve permissions) before the transfert?

  • There is not enought disk space on the server to create a tar before the transfer (it is almost 1Tb) – chi86 Mar 8 '16 at 8:56
  • and if you create all users before the transfert and make the scp with the good account ? – seb Mar 8 '16 at 9:16
  • that probably works but it is an incredible amount of work because there are many users on the server – chi86 Mar 8 '16 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.