Your profile scripts probably have some commands that expect an interactive session with a terminal emulation. And they fail when executed in a non-interactive scp session.
For example, if you are using bash, such commands should be moved from .bashrc script to .bash_profile.
Or use TERM or PS1 environment variable or similar trick to skip those commands for a non-interactive session.
# If running interactively, then:
if [ "$PS1" ]; then
#### Alex's funky commands might go here <------
/usr/bin/ssh-agent &
# If this is an xterm set the title to user@host:dir
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#### Alex's funky commands might also go here if they apply to xterm sessions <------
;;
*)
;;
esac
fi
This will not evaluate if you use scp to copy a file, but will if you start an interactive session.
(The sample code is by @Criggie)
scp file1 [email protected]:/home/user/file2?