Welcome banner stopping scp

Commands running on top of the ssh transport do not expect large amounts of output before they can start their server. This will affect a number of utilities.

The solution is to have your administration team print the message only if stdout is connected to a terminal.

if ( $?prompt ) then
    echo "Secure machine message..."
    echo "More warnings"
    echo "Etc."
endif

Better still, you wouldn't put this in .cshrc at all, but instead the message content itself would go in /etc/issue.net, which is displayed before login. This may need enabling in /etc/ssh/sshd_config though, with a line like this:

Banner /etc/issue.net

You cannot print anything in non-interactive session. That breaks any clients that use a strict protocol, such as SFTP or SCP.


Use /etc/motd (which is used for interactive sessions only).

Or use sshd_config directive Banner.

Or test for interactive session before printing anything (e.g. by testing an existence of TERM or prompt variables).


For background, see my answer to Server Fault question SSH MOTD per user.