Wierd error while setting up SFTP

Recently I had to set up SFTP access in my RedHat Linux box. After uncommenting the "Subsystem sftp ..." in the /etc/ssh/sshd_conf file, I restarted the sshd. When I tried to login, I am prompted for password but immediately I was getting this error message:
Received message too long 1214606444
Hmm ... I couldn't make out what could be the reason. Then when I Googled I cam across this page. I had the same issue in my .bashrc file where I had echoed a welcome message :-(. I confirmed that by taking the hex value of the number above (which is 0x48656C6C) which are the ASCII values of 'H', 'e', 'l' and 'l' respectively. The actual message was "Hello, have a great session!".

Moral of the story: Don't have any unnecessary echo messages in your .bash_profile or .bashrc files.

Comments

Kaar Megam said…
But, what if i want to print any message? or say, I want to change the shell to something else??

I read a solution quite long ago, that was a hack. when connected from sftp client, $SHELL (or some env var) is not set, and the solution was to test this variable and decide to print or not.. I am not sure if the solutions works on all platforms only.. i tested it on linux, it worked.. now am facing it again in solaris, but not able to fix it :(
Kaar Megam said…
Got the link..

http://lphys.chem.utoronto.ca/~cmilne/
(Stupid Unix stuff)

its $TERM and not $SHELL that will be undefined (makes sense.. shell would be defined, only then it executes the corresponding login profile)

Popular posts from this blog

Gotchas with DBCP

A note on Java's Calendar set() method

The mysterious ORA-03111 error