How to connect via SSH to your LWS web hosting

Procédure

SSH access lets you connect directly from the command line to your LWS web hosting to manage your files and run tools like WP-CLI, Composer or Git. This feature is available starting with the LWS Starter plan. Thanks to public key authentication, you benefit from a fast, reliable and highly secure connection. In this guide, we will generate an SSH key pair on your computer, register the key in your LWS Panel and open your first session in the terminal.

Generate the SSH key pair

  1. Generate your SSH key pair on your computer

    Open your computer's terminal (PowerShell on Windows, or the Terminal application on macOS and Linux). Run the following command to create a secure cryptographic key pair in Ed25519 format. When the system asks you to enter a passphrase (« passphrase »), simply press the Enter key twice to continue without a password.

    ⌨ On your computer
    ssh-keygen -t ed25519 -C "mon-ordinateur" -f ~/.ssh/lws_hebergement
    Expected result
    Generating public/private ed25519 key pair.
    Enter passphrase for "/home/tuto/.ssh/lws_hebergement" (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/tuto/.ssh/lws_hebergement
    Your public key has been saved in /home/tuto/.ssh/lws_hebergement.pub
  2. Display and copy the content of your public key

    To allow access from your machine, you must provide only your public key to the LWS server. Display its text content using the cat command in your terminal, then select and copy the entire line starting with « ssh-ed25519 ».

    ⌨ On your computer
    cat ~/.ssh/lws_hebergement.pub
    Expected result
    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOdhh1/3YU/lRVg4Sw/UcXaGnnOzxzS1jmoNMC2Pvk1f mon-ordinateur

Configure access in the LWS Panel

  1. Access your hosting management

    Log in to your LWS customer area. In the Domain(s) & Hosting(s) tab, locate your domain name in the list and then click the corresponding Manage button.

    How to connect via SSH to your LWS web hosting
  2. Open the SSH Access tool

    In your domain dashboard, scroll down to the Software block. Click the SSH Access section to configure your connection rights.

    How to connect via SSH to your LWS web hosting
  3. Open the key addition window

    The page summarizes your connection information (host, port 22 and username). Scroll down to the SSH key listing box and click the Add SSH key button.

    How to connect via SSH to your LWS web hosting
  4. Paste your SSH public key

    A pop-up window appears on the screen. Click in the SSH public key field and paste the entire text copied from your terminal in step 2.

    How to connect via SSH to your LWS web hosting
  5. Save the key on your hosting account

    Check that the string begins with the key format (for example ssh-ed25519) and contains no extra spaces at the beginning. Then click the green Add key button.

    How to connect via SSH to your LWS web hosting
  6. Access the configuration settings

    Once the key is saved in the list, go back to the top of the page in the Connection information section and click the Change configuration link.

    How to connect via SSH to your LWS web hosting
  7. Enable unlimited key access and validate

    Make sure the general option is checked on Activate. Set the Activation duration to Unlimited, then check the box SSH key authentication only (disables SSH password login) to protect your account. Finally click the green Validate button.

    How to connect via SSH to your LWS web hosting

Connect from the command line

  1. Start the SSH connection in the terminal

    Go back to your command terminal. Run the ssh command, specifying the location of your private key with the -i parameter, followed by your SSH user ID and the host name of your hosting account (indicated in your LWS Panel). On the first attempt, the terminal displays a security warning about the remote machine's fingerprint: type yes then confirm.

    ⌨ On your computer
    ssh -i ~/.ssh/lws_hebergement learn2883932@learnlws.fr
    Expected result
    The authenticity of host 'learnlws.fr (2a00:7ee0:1:0:3:2234:0:414)' can't be established.
    ED25519 key fingerprint is SHA256:pW7qVdjWOl1Ebc6mnLmjOB6Z9dno2hostWO8ew4y4Fs.
    This key is not known by any other names.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added 'learnlws.fr' (ED25519) to the list of known hosts.
  2. Navigate through your folders and close the session

    You are now connected to the Debian server of your LWS web hosting. You can check your current location with pwd and display the contents of your web directory with ls. To close the SSH session and return to your computer prompt, simply type exit.

    ⌨ On the server
    pwd
    ls
    exit
    Expected result
    /var/www/learnlws.fr/htdocs
    default_index.html
    disconnect
    Connection to learnlws.fr closed.

Glossary

SSH (Secure Shell)
Encrypted network protocol that allows secure access to and administration of a remote server via a command prompt.
Public key
Part of the encryption key that you can safely upload to the server to identify yourself during connections.
Private key
Secret file kept only on your computer that proves your identity against the public key.
Ed25519
Modern, highly efficient elliptic-curve cryptography algorithm recommended for generating SSH keys.
Fingerprint
Unique identifier of a key or server used to confirm its authenticity during the initial connection.
SFTP
Secure file transfer protocol that works over the SSH tunnel.

Frequently asked questions

Why am I getting the message « Permission denied (publickey) »?

This message indicates that the private key used on your computer does not match the public key registered in the LWS Panel, or that the -i parameter is not pointing to the correct file. Also check that you have properly checked and validated SSH service activation in your customer area.

What does the message « This service allows sftp connections only » mean?

This notification appears when full SSH shell access has not yet been validated or when the status has remained restricted to SFTP file transfer only. Go back to your LWS Panel, SSH Access section, then make sure you have checked Activate and validated the configuration.

What should I do if I get the error « REMOTE HOST IDENTIFICATION HAS CHANGED »?

This security alert appears when the remote server fingerprint has been modified (for example after an infrastructure migration). To resolve the issue, remove the old fingerprint saved on your computer with the command ssh-keygen -R your-domain.fr before reconnecting.

The SSH command does not respond, could port 22 be blocked?

Yes, some corporate networks or shared connections block outbound connections on TCP port 22. Test your connection from another network (such as a 4G/5G mobile hotspot) to check whether the block comes from your router or local firewall.

help.lws.net/a/7928
Was this article helpful?

Yes

No

Read 4 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

A question about this article?

Ask the LWS team and the community. Answers are published after moderation.

Ask the LWS team and its community a question

GDPR: Controller: LWS-Ligne Web Services. Purpose: moderation and public publication of your question, possible notification of an answer. Legal basis: consent (Art. 6(1)(a) GDPR). Email retention: 90 days after notification, 12 months maximum without an answer. To exercise your rights, see the GDPR section of our Terms and Conditions.