Monday, July 4, 2011

bash: scp: command not found

I've receive this error when I was trying to scp to a remote machine using root account. I've got this error.
bash: scp: command not found
lost connection

This error is similar to the
  1. Resolution for bash orted command not found and
  2. Unable to source path during non-interactive ssh session
If I interactive directly with the remote machine like ssh into the machine using root, I can enter into the machine. But not with scp.

I'm assuming you have in your /etc/ssh/sshd_config already allows
PermitRootlogin yes

Step 1: To solve this issue, find out where is your scp command resides in your remote computer
# which scp

Step 2: Put the path into your root .bashrc 
export PATH=/usr/bin:{$PATH}

2 comments:

bill said...

This worked great for me. Exactly what I needed.

Vijay Bhaskar said...

I missed setting it in the path. Thanks for providing the tip on
scp command in unix