Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My end goal is to copy the "directoryB" directory from machine1:/home/user1/directoryA/directoryB/ to machine2:/home/user2/someDirectory/directoryA/directoryB/. Or if easier, I am okay with just copying the files within the directoryB directory of machine1 to the coorisponding directory in machine2. The directoryB directory has multiple subdirectories and I would like to speed up the transfer time, and by intention is to use tar -cvzf.
A couple of details:
user1@machine1's public ssh key is in user3@machine2's authorized keys.
user2@machine1's public ssh key is in user1@machine2's authorized keys.
user1@machine2 has sudo access and can access user3@machine2's home directory.
I can create the tar and zip it easy enough, but the file structure just keeps on getting messed up no matter how I change -C starting/directory.
I don't need it to be the most concise way ever, and wish to keep things relatively simple and relatively concise.
As everyone has already mentioned, rsync is a good way to go. However, even though it uses SSH by default for the transport, you'll have to tell it which key to use via the -e option:
Code:
rsync -a -H -e 'ssh -i ~/.ssh/some_key' sourcedestination
Per this link, scp does not do error checking by default, but I must say I've not encountered any errors in transferring files within my LAN via scp, and I've moved everything from text files to video files. Indeed, I'm watching one of those videos files as I type this and it has progressed flawlessly.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
Thanks frankbell. Why do you need scp inside the LAN? And, you might not find errors transferring 100 files. But when you start transferring 10,000 files or more it can become more of a problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.