Hi gophers,
I'm using go.crypto package to implement a ssh server.After user
successfully login it will invoke a custom shell.
and here comes 3 questions:
1.channel returned by sConn.Accept is not a Pty.So the shell's output is
not like a shell usually do.How can i open a new pty and assign the channel
to that pty?
2.I'm using io.Copy to pipe user input.output with shell input/out.But
io.Copy will quit after an io.EOF.
3.when i invoke ssh from the shell, it'll print warnings like:* Pseudo-terminal
will not be allocated because stdin is not a terminal *, and prompt a
password request on server screen.

code of shell func is here:

func shell(c ssh.Channel) error {
shell := exec.Command("/usr/lib/gosh/gosh")
stdin, err := shell.StdinPipe()
if err != nil {
return err
stdout, err := shell.StdoutPipe()
if err != nil {
return err
stderr, err := shell.StderrPipe()
if err != nil {
return err
go func() {
io.Copy(stdin, c)
fmt.Println("stdin out")
go func() {
io.Copy(c, stdout)
fmt.Println("stdout out")
go func() {
io.Copy(c, stderr)
fmt.Println("stderr out")
return nil


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
postedDec 5, '12 at 11:53p
activeDec 5, '12 at 11:53p

1 user in discussion

Liushaohua: 1 post



site design / logo © 2022 Grokbase