LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 10: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, 10: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, 10: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 11:02 AM.
 
Old 10-04-2005, 03: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 03:41 AM.
 
Old 10-04-2005, 07: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 07:11 AM.
 
Old 10-04-2005, 09: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, 09: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, 11:19 AM   #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, 08: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!
 
Old 02-12-2018, 06:30 AM   #10
Spiffo
LQ Newbie
 
Registered: Feb 2018
Posts: 1

Rep: Reputation: Disabled
Kudos to levent.ozkan

I had to register to thank levent.ozkan. Even in 2018, your post from 2005 is still relevant!!

Been banging my head of the wall as a bunch of students could no longer copy files via mobaxterm. After getting them to try the another ssh client, I got an error message that on a google search brought me here!

Turns out a lectuer asked them to put echo comments in their .bashrc file. Commenting out this echo statements fixed this very annoying problem.

Thanks again.
 
Old 03-12-2020, 08:44 AM   #11
am115998
LQ Newbie
 
Registered: Mar 2020
Location: Hertfordshire, UK
Distribution: LinuxLite, Fedora
Posts: 5

Rep: Reputation: Disabled
Kudos to Levent Ozkan II

I also had to register to thank levent.ozkan. Even in 2020, your post from 2005 is still relevant and worked for me but I found an alternate solution before this one.
The alternate solution is from here:
https://www.digitalocean.com/communi...om-sftp-server

For a UX ssh daemon - look at the (/etc/ssh/) sshd_config file.

If you are having problems with hung logins, after a successful authentication, and have this setting in the config file:
Subsystem sftp /usr/lib/openssh/sftp-server

try changing it to:
Subsystem sftp internal-sftp

In my case, using the Filezilla debug setting and looking in the server-side /var/log/syslog and .../auth.log files I could see the authentication complete ok.
Then the sessions would hang.
In my case on a LinuxLite (Debian/Ubuntu) system, a symptom was seen from the Console-lit daemon - sample lines from syslog file:
udev-acl.ck[3131]: g_slice_set_config: assertion 'sys_page_size == 0' failed
console-kit-daemon[1659]: console-kit-daemon[1659]: GLib-CRITICAL: Source ID 60 was not found when attempting to remove it

I'd never seen that internal-sftp setting mentioned before in docs, but it *is* in the sshd_config man page.

Hope this helps.

Alex
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:58 PM.

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
Open Source Consulting | Domain Registration