I'd like to make a program that will allow me to do that:
./my_app connect prod
After this command, I'd like to be logged in that server as I would have typed manually ssh user@ip
where user and ip would be guessed inside the program.
I don't know if it is possible to run a command and attach to the process created
CodePudding user response:
If you just want to use it on linux, the easiest wait is to call syscall.Exec("/usr/bin/ssh", ..., os.Environ())
. This will replace the current process with the SSH process.