How To: Troubleshoot SCP Command



Some times we face problems in transferring the data from one machine to other machine using scp. Actually the scp command is executed successfully but the data is not transferred. As the .bashrc and not the .bash_profile file of the system to which the data is being transferred is executed. If the .bashrc of the remote system contains any command or executable which output some data to the standard output then that command is executed and the output is flushed on the local machine and the scp command is terminated and data is not transferred.

For example if the remote machine has any ‘echo’ or ‘nfrm’ command in .bashrc file, the scp of the data will not be possible.
Also suppose the remote machine has a lines in .bashrc like this

./test.sh

where test.sh contains the data as below:-

1
2
#/usr/bin/sh
echo "Kulbir Saini"

Then also the scp will not be possible.

So if you are facing such problems please try to remove such lines from your .bashrc file and scp the data you want.
Anyway you can keep those lines in your .bash_profile because it is not executed while transferring the data.

Please report any other cases in which scp is not possible.


Share

  • del.icio.us
  • Digg
  • Twitter
  • StumbleUpon
  • Reddit

Related Posts

How To: Troubleshoot SCP Command

{ 2 comments… read them below or add one }

1 Anonymouse November 13, 2008 at 4:24 PM

Try

tty -s && echo “Hello”
to mask echo outrput during a scp-session.

Cheers

Heinrich

Reply

2 Serge April 17, 2007 at 8:01 PM

Hey, I bumped into the same problem too! Did you find out exactly what happens “under the hood” of scp that leads to this? Or, did you find a way to tell from within .bashrc that it is being executed for scp and therefore should stop babbling non-sense to standard output?

thanks

Reply

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post: How To: RSA Key Generation for Remote Host

Next post: Hack: Mail Filter – Shell Script