Get Social

Howto fix bug “rsync: Failed to exec ssh -p No such file or directory”

I installed VS Code for my PHP Programming tasks and found Sync-Rsync package in marketplace. But, option “sync-rsync.shell”: “ssh -p 1234” wasn’t work…

Visual Studio Code with Sync-Rsync: Failed to exec ssh -p No such file or directory

And console output:
rsync: Failed to exec ssh -p 1234: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.1]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in IPC code (code 14) at io.c(226) [sender=3.1.1]

I tryed many config parameters, but this didn’t help.
However, the solution was found.
For fast fix simple do folowing:

Check you rsync version:
user@example:~$ rsync --version
rsync version 3.1.1 protocol version 31

As I heard, on rsync versions > 2.6 you can specify “-e ssh -p 1234” or can run rsync without it, ssh will work anyway.

edit your ~/.ssh/config
nano ~/.ssh/config

and set your server ssh settings like there:
Host example.com
User user
Hostname example.com
Port 29171
... (any your settings, like IdentityFile and other)

use rsync simply (without -e ssh, host username, port number etc.):
rsync -avz --progress --delete /home/user/some-local-path/ example.com:/home/serveruser/some-remote-path/