Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
234 views
in Technique[技术] by (71.8m points)

unix - How to use identity files with rsync and a tunnel?

I want to rsync data to a remote computer, but I have to go through a tunnel. The following works already:

rsync -rvl -e "ssh -i $HOME/.ssh/id_rsa -J [email protected]" /home/data/  user@computer42:/home/data/

However, I have to enter two passwords each time.

Above I tried to pass an identity file, as suggested in How do you use an identity file with rsync?. However, I still get a request for the first password (while there is no error message).

Also I would like to how to pass the second identity file to overcome the second password request?

question from:https://stackoverflow.com/questions/65942489/how-to-use-identity-files-with-rsync-and-a-tunnel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First of all be sure you have your public key on both servers and that is working. and by working I mean if you ssh to both of them without a password

Then I would open an ssh tunnel first then connect to the tunnel, its a bit easier to debug if needed

ssh -L 2224:computer42:22 [email protected] -N &
rsync -arpve "ssh -p 2224" /home/data/ user@computer42:/home/data/

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...