How to Copy Files to Remote Server Using 'scp' | Copying Multiple Files Simultaneously Using scp (2024)

How to Copy Files to Remote Server Using 'scp' | Copying Multiple Files Simultaneously Using scp (1)

By: Linto

JUN 15,2017

Technical

To copy files from a local system to a remote server or from a remote server to a local system, we can use the command 'scp' . 'scp' stands for 'secure copy', and it is a command used for copying files through the terminal. We can use 'scp' on Linux, Windows, and Mac.

Copying Single File to Server from Local System

The basic syntax for copying files from the local system to the remote server is,

“ scp source/filename [username]@[host]: destination ”

Here, the source is the source location, i.e., from where we want to copy files. Username is the user in the remote system, host is the address of the server, and destination is the location to which we want to copy files.

Example:

scp /home/myfile.docx root@example.com:/opt/odoo/

Copying a single file from Server to the local system

Syntax is,

“ scp [username]@[host]:source/filename [destination] ”

Example:

scp root@example.com:/opt/odoo/myfile.docx /home/

Copying Multiple Files

Suppose we need to copy multiple files from a location. Instead of copying the complete folder, we can achieve this by specifying the required files in the same command separated by space. i.e, it should be like,

scp source/file file2 file3 [user@server]/destination

If needed, it is also possible to copy from different locations. We just need to provide them in a space-separated list.

Copying Folder

Suppose we need to transfer a folder and its contents from a server or to a server instead of a file. We need a small change in the command. We need to use '-r' to specify that we need to recursively process the folder and its contents.

Example:

scp -r /home/myfolder root@example.com:/opt/odoo/

It will copy the folder and all the files in the folder to the destination location.

scp -r /home/myfolder/* root@example.com:/opt/odoo/

This command will copy all the files in the specified location to the destination

It is also possible to copy files between two remote servers. If we need to copy files from server-1 to server-2, we can use the following command,

scp [user@server-1]/source/file [user@server-2]/destination/

Copy Files To a Specific Port (Linux)

To copy files to the server at a specific port, we need to make some changes in the ssh configuration. First, we need to install ssh, typing the command

“apt-get install openssh-server”.

After ssh is installed, go to /etc/ssh/ and edit the file sshd_config as root. Change the port number to the one we want to use. By default, the port is set to 22. We can change it. After changing the port number, we may need to restart ssh.

/etc/init.d/ssh restart

Now we have to set a new port for listing ssh. In order to copy files, we also have to specify the port number. It should be like this,

scp -P [port-no] [user@server]/source/file destination.

You can check out our blog on how to install co*ckpit on the ubuntu 18.04 server. The co*ckpit is a simple, lightweight, mobile-friendly remote manager for Linux-based servers developed by Red Hat. It’s easy to start containers, visualize performance, administer storage, configure networks, inspect logs, etc. The co*ckpit is lightweight because, while active, it only uses memory and CPU. Visit the Blog Remote Server and Container Management Using co*ckpit Web Console for more information.

If you have any requirements to customize Odoo ERP Software, An enterprise application must go the client's way. Customization provides that personalized experience in an application by focusing on the client’s requirements and ideas. Odoo provides a fully functional package to meet an enterprise requirement, but there will always be an "extra" required by the clients. Contact us for Odoo Customization and related questions.
You can learn more about Odoo and Odoo Development using our Odoo Development Tutorial from the Odoo Apps Store. The Application is free to download, and you can get 100+ video tutorials to help you built Odoo Apps and Customizations easily.


How to Copy Files to Remote Server Using 'scp' | Copying Multiple Files Simultaneously Using scp (2024)
Top Articles
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 6235

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.