SSH (Secure Shell) is a key element of modern information security and remote administration. This article is dedicated to SSH connections and useful tools for working with them. Here you will find useful information on how to connect to a rented server from different operating systems, Windows, macOS, or Linux. We will also introduce you to various tools that will make working with SSH easier, such as PUTTY, Midnight Commander, and, of course, the standard terminal.
What is SSH and how to use it
SSH, or Secure Shell, is a remote connection protocol that allows you to securely manage remote servers. When you rent a shared hosting, VDS, or dedicated server, you are usually provided with a web interface or control panel that you can use to manage your server. However, behind this user-friendly graphical shell lies the work with different protocols.
The term “SSH” translates as “Secure Shell”. This technology was developed as a replacement for the old and insecure TELNET protocol, which also provided remote access to computers, but transmitted all data in clear text, including logins and passwords. Unlike TELNET, SSH encrypts all transmitted data and verifies its integrity.
Now you may have a question: “If a rented server has a web interface, file manager, FTP, and other tools, why would a regular user need to use SSH and learn commands if there are easier ways?”
There are several important reasons for this:
- Convenience. Some users find it more convenient to administer the server via SSH. Command line management is not much more complicated than working with graphical panels, and for those who are already familiar with this technology, switching to other methods may seem unnecessary.
- Advanced features. Some commands and operations can only be performed over SSH. For example, special or rarely used commands can only be accessed through SSH, extending your ability to manage your server.
- Programs and CMS. In some cases, when working with specific content managers (CMS), such as Drupal, some commands and operations can only be performed via SSH.
So, SSH is a convenient tool for advanced users and administrators, which opens up more opportunities for them to manage the server. Understanding at least the basics of SSH will allow you to better master management processes and provide more flexibility when working with the server.
Read also: WordPress: how to secure your website and avoid open source vulnerabilities
Differences between Web SSH and VNC for remote access
An SSH connection is a method, not a specific tool. To connect to a server using SSH, you need special programs and knowledge of the appropriate commands.
However, the process of establishing an SSH connection can be difficult for a beginner. The server name may be incorrect, the IP address may not be added to the list of allowed ones, or the password field may not be visible after a successful login.
Web SSH allows you to connect via SSH directly through a web browser, without the need to install additional programs on the client side. This is done by pre-installing the necessary utilities on the server side. Users can connect to the server via SSH with just one click, making the process much more accessible.
Now that we’ve covered Web SSH, let’s move on to what VNC and Web VNC are.
In the virtual server control panel, you may find that there is no Web SSH option, but there is VNC and Web VNC. What is it?
Web VNC is a remote access system or protocol that allows you to control a computer or server remotely. One of the key features of Web VNC is that you can control a remote computer that runs on a different operating system. This protocol works independently of SSH and can be a handy tool in cases where emergencies arise. For example, if a client accidentally blocks access to SSH or forgets the password to the server, Web VNC provides an opportunity to regain control of the server.
However, it is important to note that VNC and Web VNC are not usually intended for permanent operation and are more often used in situations that require restoring access to a server or computer in cases where other access methods are not available.
How to make an SSH connection to a VDS or dedicated server
If the client’s PC is running Linux or Mac OS, everything is very simple, as they already have built-in terminals that allow you to easily work with SSH. If you’re using Windows, the situation is a bit more complicated and you may need to install additional utilities, although it’s worth noting that Windows 10 already has a built-in SSH client, which makes the process easier.
Let’s try to make an SSH connection to the server using a terminal.
On Linux, you can open the terminal by simply pressing the key combination Ctrl+Alt+T. In the case of Mac OS, you need to press Command + Space and then type the word “Terminal” in the search field. This will allow you to find the terminal at the top of the list of programs.
After opening the terminal, you will need to enter the command “ssh login@servername”, where “login” is your server login that you received from the provider by email. The “servername” is the IP address of the server and you can usually find it in the main information on the client panel.
After that, the system will prompt you to enter the password for the server, and after successful entry, you will be able to control the SSH connection.
For example, here is how the process of connecting to a server on the Linux Ubuntu operating system looks like.
The most common utility for SSH connections on Windows is called PuTTY.
If you have Windows 10, the SSH client is already built-in, but sometimes you need to activate it. To do this, go to Update & Security and turn on Developer Mode. Then look for “Manage add-ons” (you can also just type this query in the search). There you will find the “OpenSSH Client,” which you need to activate.
We’ve covered the basic steps to connect to your server using this secure protocol. Depending on your operating system, server type, and your ISP’s rules, there may be some differences in the connection procedure. In any case, you can always contact our support team for advice.
Thus, you have successfully connected. What should you do next? We’re going to talk about the various SSH connection options that you can explore, even if you’re new to administration.
Basic SSH commands
SSH provides convenient access to remote servers, and an important aspect of working with it is knowing the basic commands for managing files and processes. Here are some basic SSH commands:
- ls – Use this command to display the contents of the current directory to see a list of files and folders in it.
- cd – The cd command is used to change the current working directory. For example, to change to another folder, you can use cd filename.
- mkdir – To create a new folder (directory), use the mkdir folder_name command.
- touch – To create a new file, use the touch filename command.
- rm – To delete files, use the rm filename command.
- cat – Use cat to view the contents of a file.
- pwd – This command displays the current working directory, providing the full path to that directory.
- cp – To copy files and folders, use the command cp source_file/directory target_directory.
- mv – To move files and folders, use the mv source_file/directory target_directory command.
- grep – The grep command is used to search for a specific phrase in a file. For example, grep “phrase” file_name.
- find – This command allows you to search for files and folders in a specified directory.
- vi/nano – vi and nano are text editors that allow you to edit the contents of files. Example usage: vi file_name.
- history – Use history to view a list of the last 50 commands executed.
- kill – The kill command is used to terminate a single process and requires the process PID to be specified.
- killall – Unlike kill, the killall command allows you to “kill” a program even if you do not know its PID. All you need is the name of the utility.
- rsync – This command synchronizes files between two or more hosts.
- wget – To download a file from a web link, use wget.
- zip and unzip – The zip command archives one or more files into a single .zip file, and unzip unzips the archive.
- df -h – This command displays the amount of free space on your hard disk.
These basic commands will help you efficiently manage files, search, edit text, and more on a remote server via SSH.
Midnight Commander
Midnight Commander is a file manager in the console that provides convenient access and features:
- Work with archives and network file systems (Samba, FTP, SFTP).
- Background copying and moving files.
- Built-in text editor with syntax highlighting.
- Support for text mode, remote connections (for example, SSH), and mouse.
- Multilingual interface and support for UTF-8.
To run it, use the command:
mc
Monitor server load
To monitor server load, use htop, which displays information about processes and resources:
- Monitoring the system uptime.
- Tracking server load (load average).
- View memory and CPU usage.
- Search for processes by PID and name.
- View open files and system calls.
- Supports tree view of processes and threads.
To run it, use the command:
htop
Importing and exporting a database
Use commands to move the database:
Database import:
css
mysql -h server-u user-p name_БД < file_dump
Export (creating a backup):
css
mysqldump -h server-u user-p name_БД > file_name
SSH provides reliable access to the server and understanding its principles opens up additional opportunities in server administration.