FAQ
Hello,

I wanted to implement the SFTP protocol, using the ssh package from
code.google.com/p/go.crypto/ssh. Problem is that after "con.Handshake()" ->
"channel := con.Accept()" -> "channel.Accept()" everything stands still. I
am trying to make a channel.Read() but that blocks forever.

From a user's perspective: after connecting to the go ssh server and
logging in successfully the only way to close the connection is by shutting
down the server.

Can you give me any hints, how to send/receive packets?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Daniel Theophanes at Apr 28, 2013 at 6:53 pm
    You could try to use the following as an example:
    https://bitbucket.org/kardianos/vcsguard/src/2eb2be8b45d0bf58e22de5f8026a8cb0eb0605bc/ssh.go?at=default

    As a side note, I will be making an update to that package, in a not too
    distant future.
    On Sunday, April 28, 2013 11:15:20 AM UTC-7, snore...@gmail.com wrote:

    Hello,

    I wanted to implement the SFTP protocol, using the ssh package from
    code.google.com/p/go.crypto/ssh. Problem is that after "con.Handshake()"
    -> "channel := con.Accept()" -> "channel.Accept()" everything stands still.
    I am trying to make a channel.Read() but that blocks forever.

    From a user's perspective: after connecting to the go ssh server and
    logging in successfully the only way to close the connection is by shutting
    down the server.

    Can you give me any hints, how to send/receive packets?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Snoreven45 at Apr 28, 2013 at 8:13 pm
    By looking at the code it seems as you do exactly the same right up to the
    "channel.Read(b)" part - and that's where my program hangs. I'm checking
    for a returning error, and I have a Println() directly after the read - it
    never get's there.
    I'm connecting to the server via the openssh client and Filezilla (SFTP).
    Filezilla says connection timeout, and the openssh client just doesn't
    respond anymore.

    I tested your program (I set "config.NoClientAuth = true") and Read() works
    here - I can't see any difference though.. Have to check everything line by
    line tomorrow...
    On Sunday, 28 April 2013 20:53:10 UTC+2, Daniel Theophanes wrote:

    You could try to use the following as an example:

    https://bitbucket.org/kardianos/vcsguard/src/2eb2be8b45d0bf58e22de5f8026a8cb0eb0605bc/ssh.go?at=default

    As a side note, I will be making an update to that package, in a not too
    distant future.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Daniel Theophanes at Apr 28, 2013 at 8:17 pm
    Verify you are using a new goroutine for several calls. Point to the sec if
    you want help.
    On Apr 28, 2013 1:13 PM, wrote:

    By looking at the code it seems as you do exactly the same right up to the
    "channel.Read(b)" part - and that's where my program hangs. I'm checking
    for a returning error, and I have a Println() directly after the read - it
    never get's there.
    I'm connecting to the server via the openssh client and Filezilla (SFTP).
    Filezilla says connection timeout, and the openssh client just doesn't
    respond anymore.

    I tested your program (I set "config.NoClientAuth = true") and Read()
    works here - I can't see any difference though.. Have to check everything
    line by line tomorrow...
    On Sunday, 28 April 2013 20:53:10 UTC+2, Daniel Theophanes wrote:

    You could try to use the following as an example:
    https://bitbucket.org/**kardianos/vcsguard/src/**
    2eb2be8b45d0bf58e22de5f8026a8c**b0eb0605bc/ssh.go?at=default<https://bitbucket.org/kardianos/vcsguard/src/2eb2be8b45d0bf58e22de5f8026a8cb0eb0605bc/ssh.go?at=default>

    As a side note, I will be making an update to that package, in a not too
    distant future.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/Hu23HdduOK8/unsubscribe?hl=en-US
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Snoreven45 at Apr 28, 2013 at 8:28 pm
    Good point! My Read() was not inside an extra Go routine, now it is and it
    is working - thank you!

    But why does it have to be?
    On Sunday, 28 April 2013 22:17:21 UTC+2, Daniel Theophanes wrote:

    Verify you are using a new goroutine for several calls. Point to the sec
    if you want help.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Daniel Theophanes at Apr 28, 2013 at 8:34 pm
    The Accept call must still process the packets on the connection. It
    must decode, buffer, and then if the packet is a data packet, send
    them on to the Read buffer. Thus you are actually doing several things
    in the SSH server: 1) Accepting new connections. 2) Maintaining
    accepted connections and processing packets 3) Reading and writing to
    connection. Each must be done without blocking the others.


    On Sun, Apr 28, 2013 at 1:28 PM, wrote:
    Good point! My Read() was not inside an extra Go routine, now it is and it
    is working - thank you!

    But why does it have to be?

    On Sunday, 28 April 2013 22:17:21 UTC+2, Daniel Theophanes wrote:

    Verify you are using a new goroutine for several calls. Point to the sec
    if you want help.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/Hu23HdduOK8/unsubscribe?hl=en-US.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dennis Francis at Jul 6, 2013 at 5:21 am
    Hello,

    Would you opensource your sftp implementation ? I am in need of an sftp
    package for a project.

    Thanks in advance,
    Dennis
    On Sunday, April 28, 2013 11:45:20 PM UTC+5:30, snore...@gmail.com wrote:

    Hello,

    I wanted to implement the SFTP protocol, using the ssh package from
    code.google.com/p/go.crypto/ssh. Problem is that after "con.Handshake()"
    -> "channel := con.Accept()" -> "channel.Accept()" everything stands still.
    I am trying to make a channel.Read() but that blocks forever.

    From a user's perspective: after connecting to the go ssh server and
    logging in successfully the only way to close the connection is by shutting
    down the server.

    Can you give me any hints, how to send/receive packets?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 28, '13 at 6:15p
activeJul 6, '13 at 5:21a
posts7
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase