# Log in to Linux and run a linux command via Powershell Script

**URL:** <https://forums.powershell.org/t/log-in-to-linux-and-run-a-linux-command-via-powershell-script/20164>\
**Category:** PowerShell Help\
**Created:** [August 15, 2022, 11:55am UTC](https://forums.powershell.org/t/log-in-to-linux-and-run-a-linux-command-via-powershell-script/20164 "2022-08-15T11:55:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![feri\_001](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@feri\_001](https://forums.powershell.org/u/feri_001)\
**Post date:** [August 15, 2022, 11:55am UTC](https://forums.powershell.org/t/log-in-to-linux-and-run-a-linux-command-via-powershell-script/20164/1 "2022-08-15T11:55:10Z")

</div>

Hi everyone,

How can I write a script that first logs into a Linux system via SSH and then executes a Linux command?

I thank you in advance.  
Feri

---

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [August 15, 2022, 12:16pm UTC](https://forums.powershell.org/t/log-in-to-linux-and-run-a-linux-command-via-powershell-script/20164/2 "2022-08-15T12:16:48Z")

</div>

Hello,  
You can try reading this to help:

> **[PowerShell Remoting Over SSH - PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core?view=powershell-7.2)**
>
> Explains how to set up the SSH protocol for PowerShell remoting.

-Matt

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/log-in-to-linux-and-run-a-linux-command-via-powershell-script/20164/3 "2024-05-16T20:16:47Z")

</div>

Closed on May 16, 2024, 8:16pm UTC


