Skip to content

Authentication failiure using ssh-agent #26

@pinpox

Description

@pinpox

I'm trying to connect to server using code from the examples, but the authentication fails without further information:

package main

import (
	"fmt"
	"log"

	"github.com/melbahja/goph"
)

func main() {

	auth, err := goph.UseAgent()

	if err != nil {
		log.Fatal(err)
	}

	client, err := goph.New("root", "kfbox.public", auth)

	if err != nil {
		log.Fatal(err)
	}

	// Defer closing the network connection.
	defer client.Close()

	// Execute your command.
	out, err := client.Run("ls /tmp/")

	if err != nil {
		log.Fatal(err)
	}

	// Get your output as []byte.
	fmt.Println(string(out))
}
$ go run main.go
2021/11/10 17:29:47 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
exit status 1

$  ssh [email protected]
Last login: Wed Nov 10 17:23:22 2021 from 89.0.11.182
root@kfbox:~/ >

As you can see the agent authenticates without problems when using plain ssh. Is there any way to figure out why this is failing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions