Original post

I’m trying to execute anytype of local script(sh/bash/python/ruby) or executable with arguments to a remote machine using .
ssh command: ssh user@ "python3" - < ./test.py "arg1"

package main
import (


func main()  {
    user := "user"
    hostport := ""
    script, _ := os.OpenFile("test.py", os.O_RDWR|os.O_CREATE, 0755)
    interpreter := "python3"
    client, session, err := connectToHost(user, hostport) 
    session.Stdin = script
    session.Stdout = os.Stdout
    err = session.Run(interpreter)
    if err != nil {
    defer session.Close()

The example ssh command is working fine and I’m able to execute the local test.py in the remote server too, but I can’t think of any efficient way which will help me to pass arguments(ex. arg1) as well.
Thanks for the help.