I'm looking for a way to launch ssh in a terminal from a golang program.
func main() {
cmd := exec.Command("ssh", "[email protected]", "-p", "2222")
err := cmd.Run()
if err != nil {
panic(err)
}
}
This works great until I enter the correct password, then the program exits. I guess when authentified, another ssh script in launched, but I can't figure out how to solve this. I have searched some infos about it but all I found is how to create a ssh session in go, and I would like to avoid this, if possible.
golang.org/x/crypto/ssh?exec.Command("ssh", "[email protected]", "-p" ,"2222")