Problem
$ scp username@REMOTE_IP_OR_HOSTNAME:/REMOTE_PATH/FILE_NAME .
Password:
protocol error: bad mode
The problem is that the SSH session must be "clean".
What often happens, though, is that there are statements in either the system or per-user shell startup files on the server (.bashrc, .profile, /etc/csh.cshrc, .login, etc.) which output text messages on login, intended to be read by humans (echo "Hi there!", etc.).
Solution
Find every greeting message in your startup files and only allow it to echo to standard out if you're connecting locally.For example, if in your ~/.bashrc you echo the current directory, wrap that in a test to determine whether you're connecting from a remote session.
if [ "$SSH_CONNECTION" == "" ]; then
# not a remote connection
echo "Current directory: `pwd`"
fi
No comments:
Post a Comment