Linux: Quick Start Guide for OpenSSH
Here is an example of how to connect to a remote virtual machine or server from Peerobyte to manage it using OpenSSH via PowerShell. In this example, the client system is running Windows and the server system is running Ubuntu 22.04. For other Linux distributions, the procedure will be similar, but the OpenSSH installation and user authorization procedures described in the "Installing an SSH server" and "Creating a new user" sections may be different.
Most of our Linux-based OS distribution images already have an OpenSSH server installed. If you want to connect to a virtual machine or server with a pre-installed OpenSSH server as a root user rather than a new user you created, you do not need to follow the steps in the "Server Side Action" section.
Prerequisites
- Both client and server systems must be running on a Linux-based operating system.
- A Linux terminal must be available on both the client and server systems.
- The server system should be on a Peerobyte virtual machine or server.
Steps to Follow
Server Side Actions
1. Connect to the virtual machine or server.
Connection is made through the Peerobyte control panel console, as described in the "Connecting via Console" section.
2. Update the system's package information:
sudo apt update
3. Install OpenSSH for the server:
sudo apt install openssh-server
If you wish to remotely manage the server as the root user, skip steps 4-6 for creating a new user and proceed directly to the "Client Side Actions" section.
4. Create a new user and their home directory:
useradd newuser1 -d /home/newuser1 -m
5. Set a password for the new user:
passwd newuser1
When prompted:
New password:
Create a user password, enter it and press Enter, then repeat the entry and press Enter again. The password will not be displayed on the screen during entry.
6. Add the new user to the sudo group, if needed:
usermod -aG sudo newuser1
The server part is ready for connection, moving to the client side.
Client Side Actions
1. Enter the Linux terminal.
2. Update the system's package information:
sudo apt update
3. Install OpenSSH for the client:
sudo apt install openssh-client
4. Generate a key pair:
ssh-keygen
When prompted:
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/client_user/.ssh/id_rsa):
Respond by pressing Enter, which will set the location and name of the key pair to default. Or you can enter your own path to the key, which will then also need to be specified when copying the key and connecting to the server.
When prompted:
Enter passphrase (empty for no passphrase):
Create and enter a passphrase, then press Enter. Re-enter the passphrase and press Enter again. If the passphrase entries do not match, repeat the entry.
5. Transfer the public key to the Server:
ssh-copy-id [email protected]
Take the IP address from the Main IP Address field of the "Public Network IPv4" section of the control panel of the virtual machine or server Peerobyte. Specify the username used when creating the user on the Server, or use the name root.
When prompted:
The authenticity of host '203.0.113.12 (203.0.113.12)' can't be established. ECDSA key fingerprint is SHA256:tXw8aipJLааL4KBAjCaBvHU7K//HzkXuTtdLij2yJ2U. Are you sure you want to continue connecting (yes/no/[fingerprint])?
Respond by typing yes on the keyboard and pressing Enter, confirming your intention to connect to an unknown host.
When prompted:
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new [email protected]'s password:
Enter the password assigned to the new user on the Server, and press Enter. If you specified the username root, the password to it can be taken from the Password field of the "instance Details" section of the control panel of the virtual machine or server Peerobyte.
6. Connect to the remote server:
ssh [email protected]
Take the IP address from the Main IP Address field of the "Public Network IPv4" section of the control panel of the virtual machine or server Peerobyte. Specify the username of the one created on the Server or root.
When prompted:
$ ssh [email protected] Enter passphrase for key '/home/client_user/.ssh/id_rsa':
Enter the passphrase used when creating the key pair and press Enter.
If the passphrase and all steps are correctly completed, a connection to the remote server will be established for its management, and you will see the corresponding prompt.
To terminate the connection to the server and exit to the client terminal, you can enter the command exit and press Enter.
Detailed steps for connecting through OpenSSH: