3

I am trying to use sshpass to copy a file between VMs. However when I run the command:

sshpass -p 'password' rsync --rsync-path="sudo rsync" "/home/myuser/anaconda/Anaconda2-4.3.0-Linux-x86_64.sh" "user2@destination.vm":/opt

I get the output: sshpass: Failed to run command: No such file or directory

I can ssh to destination.vm using user2 and its password.

I know sshpass is installed at /usr/bin/sshpass and is on the path.

I double checked the folders I want to copy from and to exist. I have also successfully set up passwordless sudo by editing the sudoers file.

I’m at a bit of a loss on what else to do to troubleshoot. Do you have any suggestions? Is there something else I need to do to be able to run sshpass?

EDIT:

Thank you for the responses! I have installed rsync on destination.vm as suggested and tested it with the command:

rsync -v -e ssh test.txt localhost:~

However, I am still seeing the same message when I try to use sshpass. I have successfully used this command on a different system, but I'm not sure what is different about this one that prevents the command from working.

jencoston
  • 133
  • 1
  • 1
  • 6
  • does it rsync work without `sshpass`? – Pablo Martinez Mar 10 '17 at 19:31
  • @PabloMartinez yes it works without sshpass – jencoston Mar 10 '17 at 19:36
  • (1) Do `ldd $(which sshpass)` and check all libraries resolve successfully and correctly. (2) Consider using publickey authentication, commony called passwordless, instead. – dave_thompson_085 Mar 10 '17 at 21:13
  • @dave_thompson_085 The output of that is: linux-vdso.so.1 => (0x00007ffdad663000) libc.so.6 => /lib64/libc.so.6 (0x00007f42e4cf1000) /lib64/ld-linux-x86-64.so.2 (0x00007f42e50b3000) – jencoston Mar 10 '17 at 21:15
  • vdso is a special case and not resolving is okay. Not using anything other than libc is unusual but could be correct; I don't have a build on hand to check. Try something very simple like `sshpass /bin/pwd` and if that fails (as I expect) run it again with `strace` in front to see exactly where it is hitting the error. (And don't try to put that output in a comment, it will be unreadable; edit the Q.) – dave_thompson_085 Mar 13 '17 at 00:18
  • @dave_thompson_085 `sshpass /bin/pwd` worked. I got the output /home/myuser – jencoston Mar 13 '17 at 11:51

3 Answers3

3

Install rsync on destination.vm

slass100
  • 111
  • 1
1

I had the same problem. The issue was resolved by removing the environment variables from .bashrc and directly adding them into the script.

Dhruv
  • 11
  • 1
0

I had the same problem, but in my case, Rsync package was not installed in source machine(not destination).