
In many cases, to manage your Linux servers, you can need to allow remote access and this can be done via the Secure Shell (SSH). Since many years ago, Linux systems can use the native terminal to use SSH but it was not the case for Windows systems which need some tools to be installed.
Windows systems have seen many improvements so that you don't need to install a tool but you can use native tools which are available. In this tutorial, we will learn how to ssh a Linux machine from Windows with the native tools.
What to know about SSH
Secure Shell is a secure and encrypted connection protocol allowing remote and secure sign-ins over unsecured connections. The connection works in the client-server mode, so the connection is established by the SSH client connecting to the SSH server.
SSH offers several options for user authentication and the most common ones are passwords and public key authenticationĀ methods:
- password: it works like the usual process for a local computer which means that you need to have the username and passwordĀ of an existing account on the server.
- public key:Ā the principle is to have a cryptographic key pair public key and private keyĀ where the public key is configured on the server toĀ authorize accessĀ and grant anyone who has a copy of the private key access to the server.
1) Install feature OpenSSH windows 10 client
Windows machines now allow youĀ to useĀ native tools to establish a SSH connection but you need first to make sure that the feature OpensshĀ windows client is installed. Normally is not installed by default so you will need first to do it. Go to Windows ->Ā Settings ->Ā Apps ->Ā Manage optional featureĀ

Click Add a featureĀ

SelectĀ OpenSSH Client and then install.

Now it's installed
2) SSh connection with Windows Powershell and command prompt
Now you can decide to use the command prompt or Windows PowerShellĀ to access your Linux server via ssh.
a) SSh with Windows Powershell
The Windows PowershellĀ native tool allows you to remotely connect to a server via ssh. You just have to open it withĀ Windows + r
then hit the key A

Now enter the command the ssh command for the connection to your remote Linux server: ssh root@hostname-or-ip-address

b) SSh with command prompt
To remotely access your server via the command, you just have to launch it with the key combinationĀ Windows + r
and then enter cmd

Now in the command prompt, you can use the ssh command as with powershell

Now you know how you can connect to your remote Linux server with SSH with the nativeĀ tools offered by Windows. You can choose to useĀ puttyĀ tool as well but now it's easiest and more comfortable to use the tools which are offered by default.
Hi, I am using subprocess module of Python and pOpen method. I am having python code running on Windows. I am able to connect to , submit individual command to remote Linux machine, but when I am trying bash -s < file.sh syntaxt, looks like it is not working, there is no error reported either
for e.g. I am having following 2 commands in shell script which I want to execute on remote linux machine
apt-get install -y apache2
systemctl start apache2
system says "Apache2 is not installed, etc etc.."
Any idea , is it possible to pass script as input to bash command which in itself to be executed on remote linux machine