Skip to content

SSH Gateway is not compatible with golang ssh client #7771

@iQQBot

Description

@iQQBot

Bug description

When use golang ssh client connect to workspace and execute some command, it return a error Err:wait: remote command exited without exit status or exit signal

Steps to reproduce

use this golang code connect to workspace

	client, err := ssh.Dial("tcp", "*****", &ssh.ClientConfig{
		User: "root",
		Auth: []ssh.AuthMethod{
			ssh.Password("****"),
		},
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
	})
	if err != nil {
		log.Fatalf("SSH dial error: %s", err.Error())
	}

	session, err := client.NewSession()
	defer session.Close()
	if err != nil {
		log.Fatalf("new session error: %s", err.Error())
	}

	result, err := session.Output("echo h")
	if err != nil {
		fmt.Fprintf(os.Stdout, "Failed to run command, Err:%s", err.Error())
		os.Exit(0)
	}
	fmt.Println(string(result))

Workspace affected

No response

Expected behavior

print h

Example repository

No response

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions