Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.