<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ssh on Notities</title><link>https://d8224bcf.backup-website.pages.dev/tags/ssh/</link><description>Recent content in Ssh on Notities</description><generator>Hugo</generator><language>nl</language><lastBuildDate>Mon, 20 Jul 2026 22:38:58 +0200</lastBuildDate><atom:link href="https://d8224bcf.backup-website.pages.dev/tags/ssh/index.xml" rel="self" type="application/rss+xml"/><item><title>SSH naar een externe machine met SSH-sleutels en commando uitvoeren in nieuw Python 3</title><link>https://d8224bcf.backup-website.pages.dev/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-new-python-3/</link><pubDate>Wed, 03 Apr 2024 20:20:39 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-new-python-3/</guid><description>&lt;p&gt;O﻿m een script te maken voor het uitvoeren van externe commando&amp;rsquo;s in een client-servernetwerk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import subprocess

def ssh_exec_command(hostname, username, command):
 ssh_cmd = [&amp;#39;ssh&amp;#39;, f&amp;#39;{username}@{hostname}&amp;#39;, command]
 ssh_process = subprocess.Popen(
 ssh_cmd,
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 text=True
 )
 output, error = ssh_process.communicate()

 if error:
 print(&amp;#34;Error:&amp;#34;, error)
 else:
 print(&amp;#34;Output:&amp;#34;, output)

# Vervang deze door uw werkelijke inloggegevens en commando
hostname = &amp;#39;remote_host_address&amp;#39;
username = &amp;#39;your_username&amp;#39;
command = &amp;#39;ls -l&amp;#39;

ssh_exec_command(hostname, username, command)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>SSH naar een externe machine met SSH-sleutels en commando uitvoeren in oud Python 2</title><link>https://d8224bcf.backup-website.pages.dev/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-old-python/</link><pubDate>Wed, 03 Apr 2024 20:12:58 +0000</pubDate><guid>https://d8224bcf.backup-website.pages.dev/blog/2024-ssh-in-remote-machine-with-ssh-keys-and-run-command-in-old-python/</guid><description>&lt;p&gt;I﻿n het geval u een oud legacysysteem heeft waarop nog Python 2 wordt gebruikt en u een script wilt maken om bepaalde commando&amp;rsquo;s uit te voeren in een client-servernetwerk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import subprocess

def ssh_exec_command(hostname, username, private_key_path, command):
 ssh_cmd = [&amp;#39;ssh&amp;#39;, &amp;#39;-i&amp;#39;, private_key_path, &amp;#39;-o&amp;#39;, &amp;#39;StrictHostKeyChecking=no&amp;#39;, f&amp;#39;{username}@{hostname}&amp;#39;, command]
 ssh_process = subprocess.Popen(
 ssh_cmd,
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE
 )
 output, error = ssh_process.communicate()

 if error:
 print(&amp;#34;Error:&amp;#34;, error)
 else:
 print(&amp;#34;Output:&amp;#34;, output)

# Vervang deze door uw werkelijke inloggegevens en commando
hostname = &amp;#39;remote_host_address&amp;#39;
username = &amp;#39;your_username&amp;#39;
private_key_path = &amp;#39;/path/to/your/private_key&amp;#39;
command = &amp;#39;ls -l&amp;#39;

ssh_exec_command(hostname, username, private_key_path, command)
&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>