{"id":1676,"date":"2021-12-16T13:09:52","date_gmt":"2021-12-16T10:09:52","guid":{"rendered":"https:\/\/files2.tojikon.net\/files-cloud\/2021\/03\/16\/ubuntu-copy-files-over-scp-guide\/https:\/\/files2.tojikon.net\/files-cloud\/2021\/03\/16\/ubuntu-copy-files-over-scp-guide\/"},"modified":"2021-12-16T13:09:52","modified_gmt":"2021-12-16T10:09:52","slug":"ubuntu-copy-files-over-scp-guide","status":"publish","type":"post","link":"https:\/\/tojikon.net\/en\/1676-ubuntu-copy-files-over-scp-guide\/","title":{"rendered":"Ubuntu: copy files over SCP [Guide]"},"content":{"rendered":"<section id=\"related_posts\">\n<div class=\"block-head\">\n<h3>Related Articles<\/h3>\n<\/div>\n<\/section>\n<p>If you need to copy files over the SCP protocol, the best way to do it is via the Ubuntu command-line. SCP isn\u2019t as complicated as it is made out to be, and with some guidance, you\u2019ll be able to figure out how to transfer any file or folder you like!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-397468 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/ubuntu-copy-files-over-scp-guide.png\" alt=\"Ubuntu: copy files over SCP\" width=\"1200\" height=\"554\"\/><\/p>\n<h2>Copy files over SCP via the command-line<\/h2>\n<p>To start copying files over SCP, you\u2019ll need to ensure that the computer you plan to transfer files to has an SSH server set up. Setting up an SSH server on Ubuntu is incredibly easy, as the operating system does all the heavy lifting.<\/p>\n<p>Follow the step-by-step instructions below to set up an SSH server on the computer you plan to transfer files to via SCP.<\/p>\n<p><strong>Step 1:<\/strong> Open up a terminal window on the remote Ubuntu PC. You can open up a terminal window by pressing\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>on the keyboard or by searching for \u201cTerminal\u201d in the app menu.<\/p>\n<p><strong>Step 2:<\/strong> Once the terminal window is open, make use of the\u00a0<strong>apt install\u00a0<\/strong>command to get the \u201copenssh-server\u201d package installed. This package contains everything you need to run an SSH server on Ubuntu.<\/p>\n<pre>\nsudo apt-get install openssh-server\n<\/pre>\n<p><strong>Step 3:<\/strong> Following the installation of OpenSSH on the remote Ubuntu PC, it is time to test the SSH connection. To do that, connect over SSH via the \u201clocalhost\u201d address.<\/p>\n<p>Connecting to the \u201clocalhost\u201d address in SSH allows you to SSH to your own PC for testing purposes.<\/p>\n<pre>\nssh ubuntu-username@localhost\n<\/pre>\n<p>After successfully logging in, follow along below to learn how to copy files over SCP.<\/p>\n<h3>Copy files over SCP in terminal<\/h3>\n<p>The remote Ubuntu box has an SSH server configured, and it has been tested and is working. It is now time to copy over files via the SCP protocol. To do it, open up a terminal window on the Ubuntu PC that is copying files to the remote Ubuntu PC.<\/p>\n<p>Note: if you are not using Ubuntu to copy files over SCP, do not worry. A wide variety of Linux OSes supports SCP, and the instructions below will work.<\/p>\n<p>SCP is a bit complex, so we will break down the command step-by-step. Follow along below.<\/p>\n<p><strong>Step 1:<\/strong> In the terminal, write\u00a0the first part of the command, followed by the location of the file you wish to copy over. It should look like the example below.<\/p>\n<pre>\nscp \/home\/username\/my\/file\/to\/copy.file\n<\/pre>\n<p><strong>Step 2:<\/strong> Add in the remote Ubuntu PC\u2019s user account as well as the hostname. In this example, the remote Ubuntu PC\u2019s username is \u201cderrik,\u201d and the hostname is \u201cubuntu-desktop.\u201d<\/p>\n<pre>\nscp \/home\/username\/my\/file\/to\/copy.file derrik@ubuntu-desktop:\n<\/pre>\n<p><strong>Step 3:<\/strong> Add in where the file you are transferring over SCP should land on the remote Ubuntu PC. In this example, the file will save to \/home\/derrik\/Desktop\/.<\/p>\n<p><code>scp \/home\/username\/my\/file\/to\/copy.file derrik@ubuntu-desktop:\/home\/derrik\/Desktop\/<\/code><\/p>\n<p><strong>Step 4:<\/strong> Once the entire command is filled out, it should look similar to the example below. Press the\u00a0<strong>Enter\u00a0<\/strong>key to start the transfer process. Keep in mind that both PCs must be on the same LAN for it to work correctly.<\/p>\n<pre>\nscp \/home\/username\/my\/file\/to\/copy.file derrik@ubuntu-desktop:\/home\/derrik\/Desktop\/\n<\/pre>\n<h2>Copy files over SCP with WinSCP in Wine<\/h2>\n<p>While SCP in the command-line works fine, it\u2019s not for everyone. An alternative to SCP in the terminal is WinSCP, a popular Windows application that allows users to transfer files over SCP with a GUI.<\/p>\n<p>Unfortunately, WinSCP has not been ported to Linux. However, it can run on Linux quite smoothly with the latest version of Wine. To get started, open up a terminal window on Ubuntu and install Wine\u2019s newest release with the command below.<\/p>\n<pre>\nsudo apt install wine\n<\/pre>\n<p>Next, download WinSCP to your PC and use the commands to start the installation of WinSCP.\u00a0<\/p>\n<pre>\ncd ~\/Downloads\nwine WinSCP-*.exe\n<\/pre>\n<p>Follow the on-screen prompts to get WinSCP installed. Once it is installed, follow the step-by-step instructions below to copy files over SCP with it.<\/p>\n<p><strong>Step 1:<\/strong> In the login window that appears at startup, find \u201cFile protocol\u201d and set it to \u201cSCP.\u201d<\/p>\n<p><strong>Step 2:<\/strong> Find the \u201cHost name\u201d box and write in the Ubuntu PC\u2019s hostname you are trying to transfer to. In this example, we\u2019ll use \u201cubuntu-desktop.\u201d<\/p>\n<p><strong>Step 3:<\/strong> Enter the remote Ubuntu PC\u2019s username and password in the user and password boxes.\u00a0<\/p>\n<p><strong>Step 4:<\/strong> Find the \u201cSave\u201d box and click it. Then, select \u201cLogin\u201d to log in to the remote PC via SCP.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-397467 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/ubuntu-copy-files-over-scp-guide-1.png\" alt=\"\" width=\"1200\" height=\"583\"\/><\/p>\n<p><strong>Step 5:<\/strong> Open up the Ubuntu file manager and locate the file you wish to transfer. Then, using WinSCP, access the remote folder you want to transfer the file to using the built-in browser.<\/p>\n<p><strong>Step 6:<\/strong> Using the Ubuntu file manager, drag the file into the WinSCP folder.\u00a0<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-397468 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/ubuntu-copy-files-over-scp-guide.png\" alt=\"\" width=\"1200\" height=\"554\"\/><\/p>\n<p><strong>Step 7:<\/strong> After dragging a file into the remote WinSCP folder, a pop-up will appear. Click \u201cOK\u201d to transfer the file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Related Articles If you need to copy files over the SCP protocol, the best way to do it is via the Ubuntu command-line. SCP isn\u2019t as complicated as it is made out to be, and with some guidance, you\u2019ll be able to figure out how to transfer any file or folder you like! Copy files &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1677,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[33],"_links":{"self":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1676"}],"collection":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/comments?post=1676"}],"version-history":[{"count":0,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1676\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media\/1677"}],"wp:attachment":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media?parent=1676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/categories?post=1676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/tags?post=1676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}