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" "[email protected]":/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.

6
  • does it rsync work without sshpass? Mar 10, 2017 at 19:31
  • @PabloMartinez yes it works without sshpass
    – jencoston
    Mar 10, 2017 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. Mar 10, 2017 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, 2017 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.) Mar 13, 2017 at 0:18

3 Answers 3

3

Install rsync on destination.vm

2
  • I installed rsync on destination.vm but I am still seeing the same message from sshpass
    – jencoston
    Mar 10, 2017 at 19:35
  • I installed rsync on the current vm in addition to bzip2 and now the command runs. Thank you everyone for your help!
    – jencoston
    Mar 13, 2017 at 13:33
1

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

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .