output port
This commit is contained in:
parent
39bc88bc6d
commit
398834c640
@ -17,17 +17,17 @@ func main() {
|
|||||||
|
|
||||||
publicKeyString := keyType + " " + b64.StdEncoding.EncodeToString(s.PublicKey().Marshal())
|
publicKeyString := keyType + " " + b64.StdEncoding.EncodeToString(s.PublicKey().Marshal())
|
||||||
|
|
||||||
io.WriteString(s, "Hello "+user+"\n")
|
io.WriteString(s, "Hello "+user+"\n\n")
|
||||||
io.WriteString(s, "your publicKey:\n")
|
io.WriteString(s, "your public key:\n")
|
||||||
io.WriteString(s, publicKeyString+"\n")
|
io.WriteString(s, publicKeyString+"\n\n")
|
||||||
})
|
})
|
||||||
|
|
||||||
publicKeyHandler := ssh.PublicKeyAuth(func(user string, key ssh.PublicKey) bool {
|
publicKeyHandler := ssh.PublicKeyAuth(func(user string, key ssh.PublicKey) bool {
|
||||||
//allow all
|
// allow all keys
|
||||||
// use ssh.KeysEqual() to compare agains know keys
|
// use ssh.KeysEqual() to compare agains know keys
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
log.Println("starting ssh server on port: 2222")
|
||||||
log.Fatal(ssh.ListenAndServe(":2222", nil, publicKeyHandler))
|
log.Fatal(ssh.ListenAndServe(":2222", nil, publicKeyHandler))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ func main() {
|
|||||||
io.WriteString(s, "Hello "+user+"\n")
|
io.WriteString(s, "Hello "+user+"\n")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
log.Println("starting ssh server on port: 2222")
|
||||||
log.Fatal(ssh.ListenAndServe(":2222", nil))
|
log.Fatal(ssh.ListenAndServe(":2222", nil))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user