Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-08-2009, 10:27 AM   #1
LQ Newbie
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
scp and sftp problem


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
Old 04-08-2009, 11:15 AM   #2
LQ Newbie
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0

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!

Old 01-08-2013, 08:17 AM   #3
LQ Newbie
Registered: Mar 2011
Location: London, UK
Distribution: Ubuntu + Redhat(work)
Posts: 7

Rep: Reputation: 0
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:

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:

if tty -s
  echo other output

Last edited by jgbreezer; 01-08-2013 at 08:21 AM. Reason: Mention example is for sh-type shells
Old 01-08-2013, 08:59 AM   #4
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Originally Posted by psi_mon View Post
.tcshrc file had "echo;"
See the FAQ at for details on this.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chroot SSH problem: ssh working, not SFTP & SCP. NaCo Linux - Security 3 02-01-2009 03:23 AM
scp vs. sftp Holyninja Linux - Newbie 1 10-29-2007 07:28 PM
SCP/SFTP problem tpe Linux - Security 3 03-12-2005 07:58 PM
SSH - where are scp and sftp satimis Linux - Networking 2 11-15-2003 11:27 AM
scp vs. sftp . . . zthomasz Linux - Security 2 07-08-2003 09:26 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration