Situation: When copying files from a windows machine to a linux machine by running scp on the windows machine, I get the error
stty: standard input: Invalid argument
System Info: The scp in windows machine is from "git bash". The default shell on the Linux machine is csh.
Solution: The problem here is that the Linux machine's ~/.cshrc spews out some text on stdout whenever it is sourced. If this happens, scp borks. The trick here is to modify ~/.cshrc on the Linux machine so it does not throw any output on the screen when run non-interactively. To achieve this add these lines to ~/.cshrc
# This is necessary if you want to copy files from another machine to this # machine by running scp on the other machine. if (! $?loginsh) then # echo "not a login shell" exit endif
- http://www.noah.org/wiki/SSH_notes#scp_warning:_.22stty:_standard_input:_Invalid_argument.22 shows how to do this if the default shell is bash.
- http://unix.stackexchange.com/a/26686/198064 tells how to detect if a csh shell is interactive or not.