We need to do a once-only archive copying of users' home folders to an archive server (pending final deletion) when they leave, in case they later discover that they may still require some of their files (although we do of course very strongly encourage them to take their own backup of everything they might still need before they go).We had been using scp for this, but have now got inadvertently snared by a former user who had installed some software which had created an unusual symlink structure in one of their folders, which seemed to result in scp looking ever upwards and then trying to copy rather more than was expected, before being stopped.Unfortunately, it turns out that scp seems to always follow symlinks and does not appear to have any option to prevent this.I am looking for an alternative way to backup a user folder that avoids this problem (and ideally is no more complicated than it absolutely needs to be).tar could be a possibility, but I am slightly concerned that the creation of a tarball locally before copying it to the archive server could use a not insignificant amount of storage space, and might pose some difficulties in the event that our fileserver becomes rather more full at some point in the future.Another possibility might be to use rsync, but this seems possibly over-the-top for a once-only file transfer, and I know from previous experience that tuning rsync's own options can sometimes be fiddly in itself.Can anyone suggest a reliable and simple alternative to scp for this?
Archiving user home folder to remote server, without following symlinks?
symlink;remote;file copy;file transfer
If you like tar except for the temp file, this is easy: don't use a temp file. Use a pipe.cd /home ; tar cf - user | gzip | ssh archivehost -l archiveuser 'cat > user.archived.tar.gz'Substitute xz or whatever you prefer for gzip. Or move it over to the other side of the connection, if saving CPU cycles on the main server is more important than saving network bandwidth (and CPU on the archive server)cd /home ; tar cf - user | ssh archivehost -l archiveuser 'gzip > user.archived.tar.gz'You could stick a gpg in there too. Have a key pair that's just for these archives, encrypt with the public key when storing, use the private key when you need to recover something.More details as requested:I intend user to be the user whose home directory /home/user you are archiving. archivehost is the server where you're going to store the archives, and archiveuser is an account on the archive server that will own the archives.tar cf - user means create a tar archive of user and write it to stdout. The -c is create, and -f - is use stdin/stdout as the file. It will probably work with just tar c user since -f - is likely to be the default, but originally the default action of tar was to read or write a tape device. Using an explicit -f - may just be a sign that I'm old.The tar z flag would be fine, except then I couldn't show how to move it to the other side of the ssh. (Also, connecting gzip and tar with an explicit pipe is one of those old people things - tar didn't always have that option.) Plus I can substitute bzip2, lzop, xz -3v, or any other compression program without needing to remember the corresponding tar options.I never heard of --checkpoint before, so you'll just have to rely on your own tests for that one.