Vim for remote Windows

Our development team is constantly improving the RUDDER software. They have to be at the cutting edge of technology. So they give you tips and feedbacks on the codes and techniques they use when they discover something interesting.
Here, Felix explains how you can use SSH and Vim to edit Powershell script directly in Windows systems.

Since Windows 10, Windows is shipped with an optional built-in OpenSSH server.

This is a great news, since I am used to dev on my Linux environment and with this built-in SSH server, I should be able to keep my daily tools (a shell and the Vim editor) to get the work done on my servers.

Configuring the SSH access was pretty easy, by default the password and key authentification are enabled, creating a .ssh/authorized_keys under my user home on the Windows machine was enough for my needs.

Next step, be able to run Powershell commands and edit remote files.

Powershell as default SSH shell

The SSH server runs cmd.exe as default shell, it can be changed via a registry entry.

Remote file edition using vim

Vim comes with a feature to edit remote file using SCP. The syntax is described there.

But the issue here is that Windows and Linux are using different path syntaxes and escaping methods.

Below are the different syntaxes that I ended up with when trying to access my remote files.

From Windows to Linux:
From Linux to Windows:
And now if I want to edit remote files:
But I was unable to find a syntax working for path using spaces, I tried a bunch of different potential syntaxes, none were working. As an ugly workaround, I ended up defining a Joined folder to link the Rudder folder to one without any space in its path.

There are most likely better ways to achieve this but still, I was quite happy to not have to use anymore remote desktop UI tools nor shared folders to work on my Windows dev machines.

If you have anything better, feel free to send me an email at fda@rudder.io

Félix Dallidet

Share this post

Scroll to Top
Rudder robot

Directive NIS2: how to get ready? Rudder can help you

Security management module details

This module targets maximum security and compliance for managing your infrastructure, with enterprise-class features such as:
Learn more about this module on the Security management page

Configuration & patch management module details

This module targets maximum performance and reliability for managing your infrastructure and patches, with enterprise-class features such as:

Learn more about this module on the Configuration & patch management page