LinuxQuestions.org
Register a domain and help support LQ
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-28-2003, 11:31 PM   #1
SpecialK5106
LQ Newbie
 
Registered: Oct 2003
Location: Gainesville, FL
Distribution: Slackware 9.1
Posts: 17

Rep: Reputation: 0
ls command closes sftp connection


Hi, I'm having some trouble using sftp. I'm using Slackware 9.1 with OpenSSH_3.7.1p2. Whenever I'm connecting from outside of my home network, when I use the ls command, the connection is immediately closed with the message "Read from remote host hostname.domain: connection reset by peer Connection closed". All other commands that I've tried work (including put and get, cd, mkdir, rmdir, pwd, rm). Since this problem only occurs from outside the network, I'm guessing the problem is due to the router (using NAT) that the sftp server is behind. But why with ls? What's different about that command?

Thanks
 
Old 10-29-2003, 04:50 PM   #2
SpecialK5106
LQ Newbie
 
Registered: Oct 2003
Location: Gainesville, FL
Distribution: Slackware 9.1
Posts: 17

Original Poster
Rep: Reputation: 0
I didn't realize that sftp required multiple channels like ftp. Is there any way to configure what ports sftp-server opens up when in passive mode, so that I can forward the appropriate ports on my router? The man pages for sftp-server and sftp don't say anything.
 
Old 10-31-2003, 03:39 PM   #3
SpecialK5106
LQ Newbie
 
Registered: Oct 2003
Location: Gainesville, FL
Distribution: Slackware 9.1
Posts: 17

Original Poster
Rep: Reputation: 0
Well, maybe I should have just put this in the newbie thread, but no matter how simple this problem may be, I'm at the end of my rope. SFTP doesn't seem to be documented very well. What I've read recently indicates that it emulates FTP through and ssh tunnel, meaning that I shouldn't have to forward any other ports. However, the behavior I'm getting with the ls command is exactly what would happen with passive FTP. But, using netstat, it doesn't seem that any new ports are being opened when I use ls. Can someone at least guide me to some good documentation on sftp?

Thanks in advance.
 
Old 11-02-2003, 10:35 PM   #4
SpecialK5106
LQ Newbie
 
Registered: Oct 2003
Location: Gainesville, FL
Distribution: Slackware 9.1
Posts: 17

Original Poster
Rep: Reputation: 0
The plot thickens...

So I used a packet sniffer (Ethereal) to check exactly what's going on in an SFTP connection to the sshd server from outside the home network. Only one host port and one destination port is opened for SFTP communication, so it shouldn't be a NAT problem (I'm already forwarding port 22). But here's where it gets interesting: when I send the ls command from the remote host, packets get through to the server and are acknowledged. At one point though, 3 packets in a row from the server go unacknowledged, and then I get a "destination unreachable" ICMP message from my DSL modem, which is immediately on the other side of the router. So when that message occurs, the remote sftp client has already closed?

Anyway, I'm gonna stick with this one until I figure it out, but I would love to hear anyone's thoughts on the problem.
 
Old 11-03-2003, 02:18 AM   #5
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
You could try adding

iptables -A OUTPUT -p ALL -m state --state ESTABLISHED,RELATED -j ACCEPT

or a variation on that using ip's/interfaces

Anything's worth a try.
 
  


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
How do I use sftp to upload my web site? (no sftp tar command) johnMG Linux - Networking 6 06-21-2005 09:14 PM
SSH closes connection before login goose240 Linux - Networking 4 02-14-2005 04:14 AM
qmail prematurely closes connection when trying to telnet... ivj Linux - Software 0 07-25-2004 04:47 AM
execute command when program closes frieza Linux - Software 3 11-17-2003 05:51 PM
Mozilla closes connection - no error report! CloudBuilder Red Hat 0 10-25-2003 03:11 PM


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

Main Menu
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