mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
cmd/puppeth: add ssh key choice
This commit is contained in:
parent
86be91b3e2
commit
71928bc88f
1 changed files with 9 additions and 0 deletions
|
|
@ -72,6 +72,15 @@ func dial(server string, pubkey []byte) (*sshClient, error) {
|
|||
var auths []ssh.AuthMethod
|
||||
|
||||
path := filepath.Join(user.HomeDir, ".ssh", "id_rsa")
|
||||
fmt.Printf("Which SSH key should be used? (default = %s)\n", path)
|
||||
fmt.Printf("> ")
|
||||
text, err := bufio.NewReader(os.Stdin).ReadString('\n')
|
||||
if err != nil {
|
||||
log.Crit("Failed to read user input", "err", err)
|
||||
}
|
||||
if text = strings.TrimSpace(text); text != "" {
|
||||
path = text
|
||||
}
|
||||
if buf, err := ioutil.ReadFile(path); err != nil {
|
||||
log.Warn("No SSH key, falling back to passwords", "path", path, "err", err)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue