LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 10-03-2005, 11:39 AM   #1
koyi
Member
 
Registered: Jul 2003
Location: Osaka, Japan
Distribution: Arch, Ubuntu
Posts: 421

Rep: Reputation: 31
ssh login works but sftp doesn't...


Hi, I am having a weird problem.

You see. I have setup a Debian box with a global IP address with sshd running.
I am using a firewall but I have opened port 22 for SSH connection from anywhere.

I can login with SSH without any problems, but when I try to login with sftp, it will just "hang" there after I enter the password.

I have this line in my /etc/ssh/sshd_config

Code:
Subsystem       sftp    /usr/lib/sftp-server
Since it gives me a password prompt so I guess the connection is established, but it just doesn't response after I give it my password.

Any ideas?

Thanks.
 
Old 10-03-2005, 11:48 AM   #2
levent.ozkan
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Rep: Reputation: 0
I have the same problem

Does your sftp-server executable have the right permissions for the user account you log in:

It must be something like this:

-rwxr-xr-x 1 root root 27960 Nov 28 2004 /usr/lib/sftp-server

What my question is that can you see the deamon running by using
ps -ae | grep sftp

?

I have the exact problem with you . It goes through authentication but then fails.
 
Old 10-03-2005, 11:52 AM   #3
levent.ozkan
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Rep: Reputation: 0
sftp problem

When i try to connect with "SSH Secure File Transfer Client" it prompts after failure like this:

"File transfer server could not be started or it exited unexpectedly.
Exit value 0 was returned. Most likely the sftp-server is not in the path of the user on the server-side."

I changed PATH environment variable

PATH=$PATH:/usr/lib

Now it simply does not connect :'(


Last edited by levent.ozkan; 10-03-2005 at 12:02 PM.
 
Old 10-04-2005, 04:40 AM   #4
levent.ozkan
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Rep: Reputation: 0
sftp problem in my debian box is solved

I tried to connect to the box on command-line and saw the error:

#sftp myname@myhostname
...
#Received message too long 1129730848


This was why my windows ssh transfer client was not connecting. This error is because my shell startup file was outputting text to inform human reader! Why is this a problem?

The answer is below:
http://www.snailbook.com/faq/sftp-corruption.auto.html
"
scp2/sftp and sftp-server use a special file-transfer protocol, which they speak over this SSH session. The protocol is in fact based on the same packet protocol used by SSH.

In order for this to work, the SSH session must be "clean" — that is, it must have on it only information transmitted by the programs at either end. What often happens, though, is that there are statements in either the system or per-user shell startup files on the server (.bashrc, .profile, /etc/csh.cshrc, .login, etc.) which output text messages on login, intended to be read by humans (like fortune, echo "Hi there!", etc.). Such code should only produce output on interactive logins, when there is a tty attached to standard input. If it does not make this test, it will insert these text messages where they don't belong: in this case, polluting the protocol stream between scp2/sftp and sftp-server. The first four bytes of the text gets interpreted as a 32-bit packet length, which will usually be a wildly large number, provoking the error message above.
"

There was an echo comment in my shell startup file (.bashrc). I comment it out and now i can make sftp connections both command-line and by my windows ssh file transfer client.

sorry koyi, i have partnered you thread but i hope my solution also solves your problem

Last edited by levent.ozkan; 10-04-2005 at 04:41 AM.
 
Old 10-04-2005, 08:08 AM   #5
koyi
Member
 
Registered: Jul 2003
Location: Osaka, Japan
Distribution: Arch, Ubuntu
Posts: 421

Original Poster
Rep: Reputation: 31
Re: sftp problem in my debian box is solved

Quote:
Originally posted by levent.ozkan
... What often happens, though, is that there are statements in either the system or per-user shell startup files on the server (.bashrc, .profile, /etc/csh.cshrc, .login, etc.) which output text messages on login ...
Thanks levent.ozkan!!!

This line helped me solve my problem.

Well, I don't have any line on my .login or .cshrc to output text to the console, but I have some tricks in it to change the shell at login(Ya, I know I should change my shell forever with chsh but there are some problems that prevent me from doing that...). After I removed those lines, I can log into a sftp session without any problems.

Thanks!!!

Quote:
sorry koyi, i have partnered you thread but i hope my solution also solves your problem
Ya it did!!!

Thanks again.
Hope this thread helps the others, too.

Last edited by koyi; 10-04-2005 at 08:11 AM.
 
Old 10-04-2005, 10:17 AM   #6
slinkysteve
LQ Newbie
 
Registered: Jun 2003
Distribution: Debian 3.1
Posts: 11

Rep: Reputation: 0
I'm having trouble connecting securely to my linux box - I'm using FileZilla on XP to connect through port 22 but I get the following messages

Code:
Status:	Connecting to x.x.x.x:22 ...
Status:	Connected with x.x.x.x:22. Waiting for welcome message...
Response:	SSH-2.0-OpenSSH_3.8.1p1 Debian-8.sarge.4
Error:	Timeout detected!
Error:	Unable to connect!
I can connect via the command line -> sftp steve@x.x.x.x

I can't see any echo statements in my .bashrc file so I'm totally stumped

any ideas ?

Thanks
 
Old 10-04-2005, 10:22 AM   #7
slinkysteve
LQ Newbie
 
Registered: Jun 2003
Distribution: Debian 3.1
Posts: 11

Rep: Reputation: 0
hmm never mind, I used a program called WinSCP and it managed to login fine by sftp
 
Old 10-24-2006, 12:19 PM   #8
duaux
Member
 
Registered: Mar 2002
Location: Toronto, Canada
Distribution: RH 9, Gentoo 1.4: Fluxbox!!!
Posts: 96

Rep: Reputation: 15
Thumbs up Thank you!!!

Hi levent.ozkan,

Thanks for helping us solve this problem!!!

Your help was much appreciated.

Thank you.
 
Old 02-28-2011, 09:34 AM   #9
eldnim
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
Solved - removing the echos worked - Thank you!

Removing the echos from a script my .bashrc called worked - Thank you!
 
  


Reply


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
SFTP and SSH XaViaR Linux - Security 5 07-20-2005 11:18 AM
Restricting SFTP, SSH Remote Login majicrobot Linux - Security 1 09-20-2004 11:54 AM
sftp no longer works, but ssh still does. muxman Linux - Software 0 05-19-2004 07:09 AM
ssh sftp-server dtaju Linux - Security 5 02-23-2004 05:16 PM
ssh and sftp help Rex_chaos Linux - Networking 8 03-17-2003 09:12 PM


All times are GMT -5. The time now is 05:48 AM.

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