Issue
My server config code is:
serverConfig := ssh.ServerConfig{
PublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
...
}
}
I start a ssh connection with something like ssh://user@host:port/path
. How can I get path
part of the ssh connection string in this callback or any other callbacks where I can check user's key/password?
Solution
SSH is not like http where you have ssh://user@host:port/path
. The format is user@host:port
indeed but it doesn't require the ssh://
and path constructs. In your question, PublicKeyCallback
is using the public keys. If you are doing custom things, do it outside PublicKeyCallback
.
Answered By - Mayukh Sarkar Answer Checked By - Marilyn (WPSolving Volunteer)