LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scp and sftp problem (https://www.linuxquestions.org/questions/linux-newbie-8/scp-and-sftp-problem-717709/)

psi_mon 04-08-2009 09:27 AM

scp and sftp problem
 
Hi,

I've got a problem when I try to connect to my work cluster for sftp or scp. I get as far as the password but sftp returns the message "Received message too long: 167772160" and shuts the door while scp says: "protocol error: unexpected <newline>".

I can ssh fine and have been reading around a bit and apparently it could be to do with my setup files writing out unexpected text on login. I have reverted to the standard work .tshrc file and still there are problems. Does anyone know what other files scp or sftp might be reading that are causing the problem?

Thanks for your help

psi_mon 04-08-2009 10:15 AM

solved
 
Managed to fix it!

For some reason my .tcshrc file had "echo;" right at the bottom. I have no idea what that was supposed to be doing as it is in the standard .tcshrc file that my work suggests we use.

Hopefully there'll be no ill effects of commenting it out!

Thanks

jgbreezer 01-08-2013 07:17 AM

If you need to output to the terminal for normal logins in your profile/login file, but not break scp use, you can use the "tty" command - with the "-s" option it just gives you an exit status that tells you if the terminal is valid (ie. if it exists). An example for one-off echo commands in sh/bash like shells:

Code:

tty -s && echo 'this text only output when a terminal exists, so scp still works'
Or for more extensive output over multiple commands/lines, of course use:

Code:

if tty -s
then
  ls
  echo other output
fi


linosaurusroot 01-08-2013 07:59 AM

Quote:

Originally Posted by psi_mon (Post 3502538)
.tcshrc file had "echo;"

See the FAQ at snailbook.com for details on this.


All times are GMT -5. The time now is 09:28 AM.