<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Golang_ssh</id>
	<title>Golang ssh - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Golang_ssh"/>
	<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Golang_ssh&amp;action=history"/>
	<updated>2026-05-17T16:01:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://tech.uvoo.io/index.php?title=Golang_ssh&amp;diff=1051&amp;oldid=prev</id>
		<title>Busk: Created page with &quot;https://stackoverflow.com/questions/37679939/how-do-i-execute-a-command-on-a-remote-machine-in-a-golang-cli  ``` package main  import (     &quot;bytes&quot;     &quot;log&quot;     &quot;os/exec&quot; )...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Golang_ssh&amp;diff=1051&amp;oldid=prev"/>
		<updated>2020-12-08T21:39:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;https://stackoverflow.com/questions/37679939/how-do-i-execute-a-command-on-a-remote-machine-in-a-golang-cli  ``` package main  import (     &amp;quot;bytes&amp;quot;     &amp;quot;log&amp;quot;     &amp;quot;os/exec&amp;quot; )...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;https://stackoverflow.com/questions/37679939/how-do-i-execute-a-command-on-a-remote-machine-in-a-golang-cli&lt;br /&gt;
&lt;br /&gt;
```&lt;br /&gt;
package main&lt;br /&gt;
&lt;br /&gt;
import (&lt;br /&gt;
    &amp;quot;bytes&amp;quot;&lt;br /&gt;
    &amp;quot;log&amp;quot;&lt;br /&gt;
    &amp;quot;os/exec&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
func main() {&lt;br /&gt;
    cmd := exec.Command(&amp;quot;ssh&amp;quot;, &amp;quot;remote-machine&amp;quot;, &amp;quot;bash-command&amp;quot;)&lt;br /&gt;
    var out bytes.Buffer&lt;br /&gt;
    cmd.Stdout = &amp;amp;out&lt;br /&gt;
    err := cmd.Run()&lt;br /&gt;
    if err != nil {&lt;br /&gt;
        log.Fatal(err)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
To jump over machines use the ProxyCommand directive in a ssh config file.&lt;br /&gt;
&lt;br /&gt;
Host remote_machine_name&lt;br /&gt;
  ProxyCommand ssh -q bastion nc remote_machine_ip 22&lt;br /&gt;
```&lt;/div&gt;</summary>
		<author><name>Busk</name></author>
	</entry>
</feed>