2

I am trying to run commands remotely via SSH using the following syntax:

ssh user@host "ps -eaf"

This has normally worked in the past, however in this case I keep getting the SCP Usage Returned.

usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 ... [[user@]host2:]file2

How can I solve this problem?

  • 1
    Uhm... it tells you the usage of scp? Are you sure you wrote everything correctly? The command is fine and should work. – Ziazis Jan 23 '18 at 8:40
  • Its so strange! Yeah every-time it returns the usage of SCP. I cannot figure it out. – josh Jan 23 '18 at 8:45
  • 1
    Does it return the same if you just do ssh gibberish or, on the host machine ps -eaf ? Check your .bashrc, there might be a clue in there. – M. Becerra Jan 23 '18 at 8:46
  • 1
    Other things to check might be an inappropriate ProxyCommand setting in your local ~/.ssh/config or /etc/ssh/ssh_config, or a ForceCommand setting in the remote server's /etc/ssh/sshd_config – steeldriver Jan 23 '18 at 12:10
  • 1
    You noted above that ssh is /usr/bin/ssh - but did you check what /usr/bin/ssh actually is? Did the binary itself get overwritten with scp? For example, what do /usr/bin/ssh -v and ls -li /usr/bin/{ssh,scp} say? – steeldriver Jan 23 '18 at 19:22
0

/etc/passwd was pointing to /user/local/bin/rootsh instead of /bin/bash

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.