How to use SSH on linux webhosting

Introduction
SSH (Secure Shell) is a secure protocol that enables a safe and efficient connection between two computers, facilitating data exchange through a secure channel. With SSH, you can connect securely to your web space and perform various operations, such as:
  • Uploading and downloading files and folders.
  • Editing, deleting, and moving files and folders.
  • Using Composer.
  • Utilizing GIT commands for version management.
  • For WordPress users, interacting with your WordPress installation using wp-cli.
To enable the SSH service and upload your SSH key, you can access the function within the admin.forpsi.com panel. 
Kindly note that this service is currently available exclusively for Linux hosting on our new platform. If you cannot find the SSH option in your domain settings on the control panel, we recommend reaching out to our customer support. They will assist you in exploring the possibility of migrating your web to the new platform, which will grant you access to this SSH service.


Important Note
When connecting via SSH, it's essential to use a command-line interface rather than a graphical interface. Special commands are used to perform specific operations, such as modifying, deleting, or moving files and folders. It is strongly recommended to create a backup before using SSH to prevent data loss.

How to Connect via SSH to Your Domain
To connect to your domain via SSH you will need an SSH client. If you're using the Windows operating system, an SSH client is typically included by default. Alternatively, you can use the free PuTTY client, which can be downloaded from this link.

To initiate the connection, you will need the following information:

Host: Your domain name
Username: Visible in the admin.forpsi.com panel
Port: 2222

The SSH command for connecting should look like this: "ssh -p 2222 your-username@your-domain.com".

Important Reminder
Please keep in mind that the SSH containers have a lifetime of 2 hours. It is essential to complete your SSH sessions and operations within this timeframe.

Conclusion
SSH provides a secure and efficient way to manage your website. By using an SSH client and the provided connection details, you can perform various tasks and interact with your website effectively. Always remember to take precautions and perform backups before making any significant changes via SSH.

Creating SSH Keys

Windows
Windows 10 and newer versions include native OpenSSH tools, allowing you to generate SSH keys using PowerShell. Here's a step-by-step guide:        
  1. Open PowerShell: Press Windows + X, then select "Windows PowerShell" or "Windows PowerShell (Admin)".
  2. To generate an RSA key pair, type the following command: ssh-keygen -t rsa
  3. The system will prompt you to choose the location to save the keys. Press Enter to accept the default location (C:\Users\YourUsername\.ssh\id_rsa) or specify a custom one.
  4. You can choose to set a passphrase for the private key or leave it empty for no passphrase (although setting one is more secure).
  5. The SSH key pair will be generated and saved in the specified location.
In older versions, you have to use third-party software like PuTTYgen, which often comes bundled with the PuTTY SSH client. Here's a step-by-step guide on creating SSH keys using PuTTYgen:
  1. Download and install PuTTY if you haven't already. You can find it here.
  2. Launch PuTTYgen.
  3. Choose the desired key type (RSA is commonly used).
  4. Click the "Generate" button to create a new key pair.
  5. Follow the on-screen instructions to move your mouse cursor randomly within the PuTTYgen window to generate key entropy.
  6. Once the key pair is generated, you can set a passphrase for added security if you wish.
  7. Save the public key with a .pub extension and the private key with a .ppk extension.
Linux
Linux distributions often come with the OpenSSH suite pre-installed, allowing you to create SSH keys using the terminal. Follow these steps:
  1. Open the terminal.
  2. To generate an RSA key pair, type the following command: ssh-keygen -t rsa
  3. The system will prompt you to choose the location to save the keys. Press Enter to accept the default location (~/.ssh/id_rsa) or specify a custom one.
  4. You can choose to set a passphrase for the private key or leave it empty for no passphrase (although setting one is more secure).
  5. The SSH key pair will be generated and saved in the specified location.

Once you have your SSH keys created using either method, you can then upload the public key to the admin.forpsi.com panel to enable SSH access to your web domain. Keep your private key safe and never share it with other parties.