Web Hosting - Copy files using SCP command
Find out how to use the Secure Copy Protocol (SCP) command in SSH to copy files to and from your web hosting plan
Objective
With the Secure Copy Protocol (SCP), you can securely copy data between two devices (using SSH protocol). You can copy content:
- Present locally from your computer to a remote device.
- From a remote device to your computer.
- From one server to another (unavailable between two OVHcloud web hosting plans).
It allows you to copy a file or folder containing one or more files from a terminal using a Linux command.
Information regarding OVHcloud service administration and how to find appropriate assistance
When using OVHcloud guides, please be aware of the following conditions:
- User instructions aim to provide as many details as possible but cannot cover individual use cases. You might need to adapt the pertinent actions to your requirements.
- The OVHcloud ecosystem is built for flexibility and freedom of choice. Customers are therefore responsible for the secure and proper configuration of their services. To prevent data loss, we strongly recommend to apply backup strategies to all your important data.
- Our guides and tutorials may reference third-party software or services in combination with OVHcloud solutions. The technical support provided by OVHcloud does not include the configuration of systems or products outside of our responsibility. This includes but is not limited to:
- Operating systems and user interfaces (Windows, Debian, Plesk, etc.).
- Any other third-party software (FTP clients, email software, etc.).
- Services offered by other providers (DNS, APIs, user interfaces, etc.).
To receive the appropriate assistance for any issues you might experience, follow these guidelines:
- You seek personalized advice or you would like to discuss a topic that is not covered in detail by our documentation?
Join the OVHcloud Community to search for your topic and reach out to other users. - You need to report an incident regarding your OVHcloud service or you are experiencing difficulties in the OVHcloud Control Panel?
Create a support request in our Help Centre. - You require professional assistance for your project or you need help with tasks outside our support scope?
Visit our partner portal to search for experts who are familiar with OVHcloud solutions. - You are looking for more detailed information regarding our support levels and Professional Services?
Please visit our web pages for OVHcloud support levels and OVHcloud Professional Services.
You can participate in improving our documentation:
- You would like to share feedback to improve a guide page or you want to report insufficient information on a specific page?
Use the "Was this page helpful?" buttons at the bottom of the page to let us know. - You would like to propose a specific documentation update?
Use the "Edit this page" function, available at the bottom of the page and in the sidebar.
This guide explains how to use the Secure Copy Protocol (SCP) command in SSH to copy files to and from your Web Hosting plan.
Requirements
- A terminal compatible with Linux and SSH commands (for example, the terminal of MacOS or the Ubuntu emulator on Windows)
- Familiarity with Linux and SSH commands
- A web hosting plan with SSH access
Instructions
This guide will provide a non-exhaustive list of the features available with the scp command. Please feel free to chat with our community of users if you would like to learn more.
Step 1 - Retrieve SSH access from your web hosting plan
To find the SSH access for your web hosting plan, please read our guide on Using SSH access for your web hosting plan.
Step 2 - Retrieve the full path to your web hosting plan’s FTP storage space
Open your terminal and connect to your web hosting plan via SSH.
Once you have logged in to your web hosting plan via SSH, enter the following command:
Confirm the command using the Enter(↲) key on your keyboard, then enter the following command:
Confirm this second command using the Enter key (↲) on your keyboard.
In your terminal, a result similar to our example below will appear:
In our example:
FTP-login: The name of one of the FTP users (primary or non-primary) of your web hosting plan./homez.XXX: filer on which your web hosting plan is located.FTP-main-login: Directory path of your web hosting plan’s FTP storage space. This directory is usually named the same as your web hosting plan’s main FTP login.
In our example, the full path to the FTP storage space to access the web hosting plan’s FTP root is: /homez.XXX/FTP-main-login.
Only from a directory equivalent to the directory FTP-main-login of our example will you be authorised to use the scp command.
When you log in to a web hosting plan’s FTP space in the usual way, you can log in directly from the folder equivalent to the FTP-main-login folder in our example.
This is where your web hosting plan’s www folder and .ovhconfig file are located by default.
Step 3 - Use the "scp" command with your web hosting plan
All of the commands below are carried out from your device's terminal locally. You do not need to first establish an SSH connection to your web hosting plan.
The file path used with the scp command is relative to the current local directory. To transfer data to your web hosting or from the web hosting to your local device, be sure to execute your commands from the local parent directory, as shown in the examples below.
Remember to replace all of the following general settings with your own:
FTP-login: FTP login for your web hosting plan.ssh.cluster0XX.hosting.ovh.net: ReplaceXXwith the cluster number where your web hosting plan is located. If you need any further information, please refer to our guide on Using SSH access on your web hosting plan./homez.XXX/FTP-main-login/: ReplaceXXXwith the number of the filer and theFTP-main-loginby the parameters retrieved in step 2 of this guide.source_folder: The name of the source folder to be copied or in which the file to be copied is located. If the file path contains nested folders, specify all the folder names separated by a/.target_folder: The name of the target folder that will receive the local folder or file to copy. If the file path contains nested folders, specify all the folder names separated by a/.file: The name of the file to be copied using thescpcommand. Please also remember to specify the extension of this file (examples: .html, .css, .php, .txt, etc.).
Copy content from your local device to your web hosting plan
To copy a single local file to your web hosting plan, use the following command:
To copy a local folder and all of its contents to your web hosting plan, use the following command:
Copy content from your web hosting plan to your local device
To copy a single file from your web hosting plan to your local device, use the following command:
To copy a folder on your web hosting plan and all of its files to your local device, use the following command:
Copying content from your OVHcloud web hosting plan to another OVHcloud web hosting plan
For security reasons, the scp command is refused by the OVHcloud web hosting infrastructure when trying to move data from one hosting to another.
Step 4 - Make sure the content has been copied
To check that content on your computer has been copied to your web hosting plan, you can log in to your web hosting plan’s FTP storage space, then go to the target directory where the content is supposed to be.
To check that content on your web hosting plan has been copied locally on your computer, go to the target directory on your device/computer, then check that the content that is supposed to be copied is there.
Go further
Accessing a web hosting plan via SSH
Logging in to your web hosting plan’s FTP storage space
For specialised services (SEO, development, etc.), contact OVHcloud partners.
Join our community of users.