1

When i am trying to copy a file using scp, it says bash: bash:: command not found. I am able to execute help command for scp but unable to use it.

[root@centosgui ansibleplay]# scp --help
unknown option -- -
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
[root@centosgui ansibleplay]# scp CentOs-DockerManagedPluginconfiguration.yml root@othermachine-cv:/root/managed-plugin
root@othermachine-cv's password:
bash: bash:: command not found

I am using CentOS 7.5. other commands like vim, ls ,cat and etc are working fine in that machine. How to solve this?

When i run the below command, it shows bash command not found then display the help of scp command.

[root@centosgui ansibleplay]# ssh root@othermachine-cv scp --help
root@othermachine-cv's password:
bash: bash:: command not found
bash: bash:: command not found
unknown option -- -
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

When i run the below command as OP instructs

[root@centosgui ~]# ssh root@othermachine-cv grep -n "bash:" .bash{rc,_profile}
root@othermachine-cv's password:
bash: bash:: command not found
bash: bash:: command not found

From centosgui ,i am able to copy file to other centos machines. Also from othermachine-cv i am able copy the file from centosgui using scp.

  • 2
    OK, so it looks like some profile script on the server is broken. – Martin Prikryl May 6 at 7:28
  • 1
    Did you check if the file was uploaded or not? It might have, despite the error. – Martin Prikryl May 6 at 7:30
  • 1
    scp shows the usage output if no other options are provided, and in this case both -h and --help are not valid options for scp. You get the same output (without the error message) if you simply run ssh root@othermachine-cv scp. – eblock May 6 at 7:30
  • 2
    Do you get the problem when you ssh root@othermachine-cv ? – roaima May 6 at 8:47
  • 2
    Are you able to log into the remote system at all and have a look at what the root user's shell is (probably bash) and whether bash is actually installed at all on the system? – Kusalananda May 6 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.