Although the Rsync is available for Windows, there are some problems with SSH. Here is the first one: the files are simply could not be submitted because of unclear error "error in rsync protocol data stream (code 12)". If to specify -e /bin/ssh
option, the files could be submitted, but only if remote (e. g. VPS) has the password authentication. However, in real VPS the usage of SSH keys and disabling the authentication by password are basic security requirements. So, the next problem is how to submit the files by Rsync without explicitly specifying of paths to SSH keys (it is important for the automation).
Preparations
I have added the generated keys data to /.ssh/config:
Host 160.XXX.XXX.97(deployer)
HostName 160.XXX.XXX.97
User deployer
IdentityFile ~/.ssh/JXXXXXX-HomePage
To avoid the inputting of passphrase each time, it will required to launch the ssh-agent:
sss config ssh-agent start=auto
Experiment flow
Step 1. Check the normal SSH authentication from PowerShell
Thanks to ssh-agent, the bother is minimal:
ssh [email protected]
Works fine.
Step 2. Check the normal SSH authentication from WSL
Same command:
Works fine.
Step 3. Check the submitting of the files by Rsync + WSL
rsync -azve ssh 04-ProductionBuild [email protected]:/var/www/example.jp
Works fine. Now I have proved that the problem is not on the VPS side.
Step 4. Submitting of the files by Rsync from Windows
rsync -azvr -e /bin/ssh --progress ./04-ProductionBuild/ [email protected]:/var/www/example.jp
The authenticity of host '160.XXX.XX.97 (160.XXX.XX.97)' can't be established. ED25519 key fingerprint is SHA256:NFthXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXTG/Y. This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Before start experiment, the VPS has been added to the list of known host. Also, the normal SSH authentication works. If to input yes
, it will be the error:
Failed to add the host to the list of known hosts (/known_hosts). Connection closed by 160.XXX.XX.97 port 22
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]