Pc Guide

How to use SSH

SSH When we use a program on our computer, we are used to using a graphical interface to be able to manage all its functions. But if we have a data server or a hosting server for our website we will hardly apply the settings from an interface, since in most cases we will have to type commands from a prompt or terminal in order to properly administer our server. If the server is located outside our home network (for example on a server offered by a provider, or we are away from home and want to access our personal server) or we want to access it without a graphical interface, we will have to make a secure and encrypted connection to be able to send prompt commands. In this guide we will show you how to use SSH to send commands from a remote terminal on any server. Given the difficulty of the subject, we will try to be as clear and simple as possible, so that even a novice user can learn to use SSH to remotely control their server.

How to use SSH

Below you will find how to create an SSH server on Windows and Linux, how to connect to an SSH server from Windows and finally how to connect to an SSH server from smartphones and tablets (from the Android operating system and from iOS). If we do not know the origin of the SSH service, we refer you to reading the dedicated Wikipedia page.

How to create an SSH server on Windows

If we use Windows 10 on our computer, we can install the OpenSSH module. To do this, open the Start menu at the bottom left, open the app Settings, we open the menu App -> App and features and finally we click on Optional features. On the page that appears, click Add a feature, scroll through the list of functions then make sure to select the item OpenSSH Server.
SSH Windows

At the end of the server installation, we open the Start menu again, look for the app Windows PowerShell, we right-click on it and select Run as administrator. In the command line window that appears, we perform the initial configurations of the SSH server by typing the following commands from the terminal (type them one line at a time):

Start-Service sshd

Set-Service -Name sshd -StartupType ‘Automatic’

Get-NetFirewallRule -Name * ssh *

After starting these commands, the PC with Windows 10 we are using can accept SSH connections on port 22, using the access credentials configured on the Windows account (we will obviously have to forward this port to the router or modem, so that we can reach it when we are outside the personal network).

Note: if port 22 is not configurable or is not accessible from our network, simply open the file C: Windows System32 OpenSSH sshd_config and change the entry for door 22, setting a door as desired.

How to create an SSH server on Linux

On a server with Linux, configuring SSH is much simpler, since OpenSSH is well integrated with other system tools. After configuring the machine or server online with Ubuntu (taken as an example in this guide), we open the app Terminal, then type the following command:

sudo apt-get install openssh-server

We confirm where necessary to complete the installation of the OpenSSH server. To start the service immediately, simply run the command from the terminal next:

sudo /etc/init.d/ssh restart

The system will use the user account credentials for access and port 22 to accept connections from the outside.
SSH Linux

If we want to change the input port for SSH connections (for the same reasons seen on Windows), just type the command in the terminal:

sudo vi / etc / ssh / sshd_config

From the text editor we navigate through the various options until we find the item Port, so you can configure a new port for SSH connections.

How to connect to an SSH server from Windows

After configuring the SSH server, we will be able to access it from any other Windows 10 PC connected to the Internet simply by opening the Windows PowerShell program and typing the following command from the terminal:

ssh username @ hostname -p portnumber

the command consists of the username (username) requesting access, from the server name (servername) and the port number to contact.
PowerShell SSH

As a username it will be sufficient to use that of the user account configured on the server, while as servername we can directly enter the public IP address of the Internet connection used by the server or the name of the domain (if registered). The default port is 22, but we can change it without problems if the SSH server has been configured with a different port. At each connection, the login password will be requested, coinciding with the password of the system account (or of the administrator account).

If we use other versions of Windows (7 and 8.1) or want to get more control over the encrypted connection, we suggest installing the free and open source PuTTY program.
PuTTY

With this program we will be able to quickly connect to any SSH server, just enter the username in the field Host Name, configure the port in the field Port, put a check mark on the SSH item and finally click below on Open.

How to connect to an SSH server from a smartphone or tablet

If we want to control our SSH server from a smartphone or tablet, we recommend installing the free app Termius, available for both Android and iOS.

With this app we will be able to access the protected shell of any server quickly and easily, as well as access the SFTP service, which allows you to view all the server folders with administrator permissions (excellent for managing files and system folders without be physically present in front of the server).
To use the app, simply start it, indicate the access information to the server as already seen above and enter the password when requested; in an automatic way the app will connect to the server and offer us the shell from which to issue the commands, with the possibility of saving the credentials for future access.

Alternatively we can use the free JuiceSSH apps – SSH Client and JuiceSSH Performance Plugin on Android.

With these two apps we can either send commands to a secure shell or check the performance of our server, thanks to the connection plugin that will show in real time the consumption by CPU, RAM, network, disk and the average load (really very useful if we have a site with many visits or servers with few capabilities).

Conclusions

Managing an SSH server and sending commands to a secure shell are definitely operations by industry experts and system administrators, but if we want to control every aspect of our server for the website we are managing, SSH is certainly one of the tools you need to learn to use right away.

If we want to learn new commands by prompt or for PowerShell, we invite you to read our guide to the Command Prompt Cheats (CMD). If instead we want to connect to an FTP server, we can find all the necessary information in our guide on How to connect to an FTP server from PC and smartphone.
To create a new data server to use as a personal and secure cloud, we can read our in-depth information on how to Create a personal Cloud Server on the PC unlimited and free.

Leave a Reply

Your email address will not be published. Required fields are marked *