Tutorials

▷ How to use ssh in windows 10

Table of contents:

Anonim

In this article we are going to see how we can use SSH in Windows 10 from the system command line. Specifically, we will use PowerShell and the advantages it offers us. SSH is one of the most used communication protocol protocols for remote connections today due to its high security and wide compatibility with Windows and Linux.

Index of contents

Using SSH in previous versions of Windows was relatively more complicated, since you have to install external programs like Putty to get compatibility between Linux and Windows. But this is currently not necessary since Windows 10 has an SSH module to be able to make connections from our system to a client as configuring it as a server.

What is SSH

SSH or Secure Shell is a secure communications protocol to remotely connect two operating systems so that we can control a host computer from a client computer using a command console.

The most important thing about SSH is that it is capable of encrypting the connection session, which is not possible with FTP or Telnet, much more insecure and little used protocols.

SSH also allows you to copy data securely from a host to a client with the possibility of using RSA keys that are more secure than the session keys of normal users and we can also tunnel the transmission of files to acquire even more security.

Currently it is possible to SSH between practically any computer with the operating system it has, since there are specific programs to obtain compatibility, such as OpenSSH, Putty, Shell, SSH-Agent, among others.

With SSH we can connect to a computer configured as a server both on an internal network and completely remotely. To do this we will have to open TCP port 22, which is the one used by default.

Configure SSH server in Ubuntu

Now what we are going to do is configure SSH as a server on an Ubuntu computer and access it through a Windows client.

So, the first thing we will have to do is get run SSH in server mode in Ubuntu. So we are going to open a Linux terminal to start the process.

To install the SSH server we will have to execute the following command:

sudo apt-get install openssh-server

We put the password and the installation process will take a few seconds. The most important commands to manage our SSH server in Ubuntu will be the following:

sudo gedit / etc / ssh / sshd_config

With this command we will open the SSH configuration file to edit parameters such as the communication port, the encryption protocol or other aspects.

sudo /etc/init.d/ssh start

Command to start the SSH server

sudo /etc/init.d/ssh stop

Command to shutdown SSH server

sudo /etc/init.d/ssh restart

Command to restart the SSH server after a configuration change, for example

We in principle, this configuration file we are going to leave it as it is by default, since the tutorial is about establishing a communication from Windows and not configuring a server in Ubuntu

So. What we will do is run the command relative to starting the SSH daemon. Now we will move to Windows.

See IP address of our Linux server

We only have to know the IP address of the SSH server that we have activated. For this we use the command:

ip to list

Connect to SSH client Windows 10

To use SSH Windows 10 we will have to use PowerShell or command prompt and do some procedures to activate the program and be able to use it in our command console

Install SSH Client Windows 10

With Windows 10 we have it easy enough. We can activate both an SSH client and a server through the list of characteristics in the configuration panel.

  • We go to the start menu and click on the cogwheel to open the configuration panel. We choose the " Applications " option and within this we place ourselves on the " Applications and features " option Now we must click on the option in the right area of “ Manage optional functions

Within the list that will appear, we may already have the default ssh client installed, in which case it will appear in this list.

  • If we do not have it installed, click on " Add a feature "

Once inside the list of features we must locate the two applications that interest us: " OpenSSH Client " and " OpenSSH Server"

In both cases we will click on “ Install ”. If we return to the previous window we can see how these elements will already appear installed.

Now we will be able to use the SSH client to connect to our Ubuntu team

Connect SSH client to Linux from Windows 10

The first thing we have to do is open a PowerShell window. To do this we right click on the start menu button and choose " Windows PoweShell ".

If we write the command:

ssh

We will obtain information about the different options that we have available.

To connect to a server with SSH from Windows 10 the only thing we will have to write is the following:

ssh @

For example " ssh [email protected] ". It will automatically ask us for the Ubuntu user credentials and we will have accessed

If we do not write a user, by default the user that is available on the server system will be detected, as in this case:

Due to defects we will be in the / home directory of the Ubuntu system user. And we can already do what we want on our server equipment remotely.

To disconnect from the session we will only have to write the command:

exit

To connect remotely from a network other than ours, we will have to open port 22 of our router and enter with the real IP of our internet link.

Configure SSH server Windows 10

Now we will perform the same procedure, but from a Windows client to a server also in Windows. Before we already proceeded to install the SSH server for Windows, so now you only have to start it to connect.

Start SSH Server in Windows 10

To open the list of system services and activate the SSH server we are the following:

  • Press " Windows + R " to open the Run tool and place the following command inside:

services.msc

  • Now we must locate the service the services " OpenSSH Authentication Agent " and " OpenSSH SSH Server "

What we can do now with these two services is configure them to start when the system starts

  • First we right click on “ OpenSSH SSH Server ” and choose “ Properties ”. A window will open in which we must choose “ automatic ” as “ start type ”. Then we click on “ Start

  • Now we do the same with " OpenSSH Authentication Agent ".

We will already have the SSH server running on our server machine.

Enable listening port for OpenSSH Windows 10

This is especially useful if what we want to do is remotely access port 22 to our SSH server. We will have to place the following command in our PowerShell console executed with administrator permissions

New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Service sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow -Profile Domain

Connect a Windows 10 SSH server

Well, everything is ready to connect to our newly configured Windows 10 server.

What we will have to do is the same procedure as before, although if the IP of our team is the same as the one we previously accessed on the Ubuntu server, it will not give an error.

Fix error remote host identification has changed SSH

This error jumps at us because we have previously accessed an SSH server with the same IP address as another that we currently have. Because it is a different operating system and another domain is running, the security RSA key associated with the server is different and we will get this error.

In order to solve it, all we have to do is enter a PowerShell or Command Prompt window as administrator and type the following command:

ssh-keygen -R

For example, in our case: " ssh-keygen -R 192.168.2.104 " and in this way the list of associated keys will be emptied to request a different one

Now we run the connection process again and this will be successful

Connect to a Windows 10 SSH server from Ubuntu

Now we will see a very useful way to connect to an SSH server in Windows 10 from Ubuntu and any other Linux and it is through a graphical interface.

What we will do is open the Ubuntu file explorer and press the " Ctrl + L " key combination to enable the browser's address bar.

To access the server we will write the following command or line:

ssh: // @

for example " ssh: //[email protected] " will ask for the security confirmation and then the user password.

In this way we will access through the graphical interface the files stored on the server computer

Remotely connect to an SSH server

To finish we will also mention the possibility of connecting remotely to our SSH server, both Windows and Linux. The only thing we will need to take into account is the fact of being outside of a private network as before.

We will need to know the real IP of the server and the port where the transmission will go, which by default will be port 22. In this way the command that we will have to use to connect will be the following:

ssh -p 22 @

for example, in our case it would be: “ ssh -p 22 Dell @ IP-real

Going forward, the process will be identical.

The following tutorials could also be useful:

What systems do you want to connect by SSH? If you have had any problem connecting, leave it in the comments to help you

Tutorials

Editor's choice

Back to top button