What is SSH and the main ways to work with it

What is SSH and the main ways to work with it

SSH (Secure Shell) — is a protocol for secure remote connection to a server and managing it via the command line. After renting a server — VPS/VDS or dedicated — SSH often becomes the primary tool for system administration. In this article, we will discuss how SSH connections work, how to connect to a server from Windows, macOS, or Linux, and which tools can simplify working with SSH: PuTTY, Midnight Commander, and the standard terminal.

What is SSH and what is it used for

SSH (Secure Shell, «secure shell») — is a network protocol used for remote management of servers and other devices. It allows for secure transmission of commands and data over an encrypted connection.

SSH was created as a more secure alternative to the Telnet protocol, which transmitted data in plain text, including logins and passwords. Unlike Telnet, SSH uses encryption and data integrity verification mechanisms, significantly enhancing the security of the connection.

When renting a VPS/VDS or dedicated server, users typically gain access to a control panel or web interface. However, many administrative tasks are performed via SSH — especially when full control over the system is required or access to features not available in the graphical interface.

SSH is used for several reasons:

  • Quick administration. Many actions are performed faster via the command line than through a web interface, especially when regularly working with the server.
  • Advanced management capabilities. Some system utilities, services, and settings are only available through the console.
  • Working with frameworks and CMS. Some tools for website development and administration (such as Composer, Drush, or WP-CLI) operate via SSH.

Even a basic understanding of SSH significantly simplifies working with the server, provides more control over the system, and allows for faster execution of administrative tasks.

Also read: WordPress: how to protect your site and avoid open-source vulnerabilities

Differences between Web SSH and VNC for remote access

SSH — is a remote access protocol, not a standalone program. To connect to a server via SSH, specialized clients are usually used, such as PuTTY, OpenSSH, or the standard terminal in Linux and macOS. The user also needs to know the server address, login, password, or SSH keys, and basic commands for working in the console.

For beginners, such a connection may not be very convenient: an error in the server address, incorrect access parameters, or network restrictions can prevent the connection from being established.

That’s why many hosting providers offer Web SSH — browser access to the SSH console without the need to install additional software. In this case, the connection to the server is made through the web interface of the control panel, and the user gains access to the console directly in the browser.

In addition to Web SSH, VPS/VDS control panels often provide VNC or Web VNC. Unlike SSH, VNC provides not access to the command line, but full remote control of the server's graphical interface — essentially as if you were working directly at the machine.

Web VNC works similarly but opens directly in the browser without the need to install a separate VNC client.

Server control panel and using VNC

Web VNC — is a remote access technology that allows you to manage a computer or server through a graphical interface. One of the features of Web VNC is the ability to connect through a browser without installing a separate VNC client. This access works independently of SSH and can be useful in cases where there are issues accessing the server.

For example, if a user accidentally blocks SSH access, misconfigures network settings, or loses access to credentials, Web VNC allows access to the server and the ability to correct the settings.

At the same time, VNC and Web VNC on servers are usually not used for permanent administration but for emergency access, diagnostics, or initial system setup in cases where SSH is unavailable.

How to establish an SSH connection to a VDS or dedicated server

If you have Linux or macOS installed on your computer, connecting via SSH is quite simple, as these operating systems already have a built-in terminal with SSH support. In Windows, the situation was previously more complicated, but in Windows 10 and newer versions, there is also a built-in SSH client.

Let’s see how to perform an SSH connection to the server via the terminal.

In Linux, you can open the terminal with the key combination Ctrl + Alt + T. In macOS, press Command + Space and type the word «Terminal» in the search.

After opening the terminal, enter the command:

ssh login@servername

where login — is the server user login, and servername — is the IP address or domain name of the server. This information is usually sent by the hosting provider after the service is activated and is available in the control panel.

After executing the command, the system will prompt you to enter the password. If the information is entered correctly, an SSH connection will be established, and you will gain access to manage the server via the console.

For example, this is what the connection process to a server looks like in Linux Ubuntu.

Connecting to a server on Linux OS

For a long time, PuTTY remained the most popular SSH client for Windows.

In Windows 10 and newer versions, the OpenSSH SSH client is usually already built into the system, but in some cases, it may need to be activated additionally. To do this, open the «Optional Features» section in Windows settings and ensure that the OpenSSH Client component is installed.

We have covered the basic steps for SSH connection to the server using this protocol. Depending on the operating system, server configuration, and access settings, the connection procedure may vary slightly. If difficulties arise, it is advisable to contact the hosting provider's support service.

After successfully connecting via SSH, the user gains access to a wide range of tools for server administration. Next, we will look at the basic capabilities of working through SSH that will be useful even for beginners.

Basic SSH Commands

After connecting via SSH, the user gains access to the server's command line. Standard Linux commands are used to work with files, directories, and processes. Here are some basic SSH commands:

  • ls — shows the contents of the current directory.
  • cd — used to navigate between directories. For example: cd foldername.
  • mkdir — creates a new directory. For example: mkdir foldername.
  • touch — creates a new file. For example: touch filename.
  • rm — deletes files and directories.
  • cat — outputs the contents of a file to the console.
  • pwd — shows the full path to the current directory.
  • cp — copies files and directories.
  • mv — moves or renames files and directories.
  • grep — searches for text in files. For example: grep "phrase" filename.
  • find — searches for files and directories based on specified parameters.
  • vi / nano — text editors for working with files via the console.
  • history — shows the history of executed commands.
  • kill — terminates a process by its PID.
  • killall — terminates processes by name.
  • rsync — used for copying and synchronizing files and directories.
  • wget — downloads files from a URL.
  • zip and unzip — create and extract ZIP archives.
  • df -h — shows information about disk space usage.

These commands help perform basic server administration, work with files, view system information, and manage processes via SSH.

Midnight Commander

Midnight Commander (mc) — is a console file manager for Linux and Unix-like systems that simplifies working with files and directories through the terminal.

Key features of Midnight Commander:

  • working with archives and network file systems (Samba, FTP, SFTP);
  • copying and moving files in the background;
  • built-in text editor with syntax highlighting;
  • support for working via SSH and other remote connections;
  • mouse support, UTF-8, and multilingual interface.

After connecting to the server via SSH, enter the command in the terminal: mc

Midnight Commander access to server using command mc

Monitoring server load

To monitor the server's status and active processes, the htop utility is often used. It allows real-time viewing of system resource usage information.

Key features of htop:

  • viewing system uptime;
  • monitoring server load (load average);
  • controlling CPU and memory usage;
  • searching for processes by PID or name;
  • viewing the tree structure of processes;
  • managing processes directly from the utility's interface.

After connecting to the server via SSH, you can start htop with the command: htop

Monitoring load on a virtual server using the htop command

Importing and exporting databases

To import and export MySQL databases via SSH, you can use the following commands.

Importing a database:

mysql -h server -u username -p database_name < dump.sql

Exporting a database (creating a backup):

mysqldump -h server -u username -p database_name > backup.sql

These commands allow for quick database transfers, creating backups, and restoring data without using a web interface.

Working through SSH provides more opportunities for server administration, task automation, and system management via the command line.