{"id":1381,"date":"2019-02-18T11:10:19","date_gmt":"2019-02-18T05:40:19","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1381"},"modified":"2019-02-25T08:02:06","modified_gmt":"2019-02-25T02:32:06","slug":"how-to-copy-files-between-hosts-in-a-network-using-dcp","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-copy-files-between-hosts-in-a-network-using-dcp\/","title":{"rendered":"How to copy files between hosts in a network using DCP"},"content":{"rendered":"\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Description<\/strong><\/p>\n\n\n\n<p>We often need to copy or share files over the network. <\/p>\n\n\n\n<p>Many of us are used to using tools such as <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"http:\/\/jaipurhosting.com\/blog\/how-to-transfer-files-using-rsync-command\/\" target=\"_blank\">rsync<\/a>&nbsp;or&nbsp;scp to transfer files between machines. <\/p>\n\n\n\n<p>In this tutorial, we are going to review another tool that can help you copy files between hosts in a network \u2013&nbsp;<strong>Dat Copy<\/strong>&nbsp;(<strong>dcp<\/strong>). <\/p>\n\n\n\n<p><strong>Dcp<\/strong>&nbsp;does not require SSH to be used or configured in order to copy your files. <\/p>\n\n\n\n<p>Furthermore it does not require any configuration to securely copy your files.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Dcp Use Cases<\/strong><\/p>\n\n\n\n<p><strong>Dcp<\/strong>&nbsp;can be used in multiple scenarios. <\/p>\n\n\n\n<p>For example, you can easily send files to multiple colleagues by simply providing them with the generated key. <\/p>\n\n\n\n<p>You can also&nbsp;sync data between two machines&nbsp;without the need of setting SSH keys. Copy files to remote machine or share files between Linux, MacOS, Windows. <\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>How Dcp Works<\/strong><\/p>\n\n\n\n<p><strong>Dcp<\/strong>&nbsp;creates a&nbsp;<strong>dat<\/strong>&nbsp;archive for the list of files you have specified to be copied over. <\/p>\n\n\n\n<p>Then, using the generated public key it allows you to download the files from another host. <\/p>\n\n\n\n<p>The copied data is encrypted using the public key for the dat archive.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>How to Install Dcp in Linux Systems<\/strong><\/p>\n\n\n\n<p> Installation of&nbsp;<strong>dcp<\/strong>&nbsp;can be completed with&nbsp;npm package manager. <\/p>\n\n\n\n<p>However if you don\u2019t wish to use&nbsp;<strong>npm<\/strong>, you can download the latest release of the&nbsp;<strong>dcp<\/strong>&nbsp;package from the&nbsp;<a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/github.com\/tom-james-watson\/dat-cp\/releases\" target=\"_blank\">release page<\/a>. <br><\/p>\n\n\n\n<p> To install the package with&nbsp;<strong>npm<\/strong>, you must have&nbsp;NPM installed on your Linux system&nbsp;and then use the following command to install it. <\/p>\n\n\n\n<p><strong><em># npm i -g dat-cp<\/em><\/strong><\/p>\n\n\n\n<p>If you prefer to use the zip archives, you can download them with&nbsp;wget command.<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong><em># wget https:\/\/github.com\/tom-james-watson\/dat-cp\/releases\/download\/0.7.4\/dcp-0.7.4-linux-x64.zip<\/em><\/strong><br><\/pre>\n\n\n\n<p>Then move the&nbsp;<strong>dcp<\/strong>&nbsp;and&nbsp;<strong>node-64.node<\/strong>&nbsp;binaries to a path by your choice, preferably a path that is included in your PATH variable. For example&nbsp;<strong>\/usr\/local\/bin\/<\/strong>:<\/p>\n\n\n\n<p><strong><em># mv dcp-0.7.4-linux-x64\/dcp dcp-0.7.4-linux-x64\/node-64.node \/usr\/local\/bin<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>How to Use Dcp in Linux Systems<\/strong><\/p>\n\n\n\n<p>Usage of&nbsp;<strong>dcp<\/strong> is simple and as mentioned earlier does not require any extra configuration. Simply choose the files that you wish to copy and run:<\/p>\n\n\n\n<p>Send file from source host:<\/p>\n\n\n\n<p><strong><em># dcp file<\/em><\/strong><\/p>\n\n\n\n<p>Run the command below on the target host.<\/p>\n\n\n\n<p><strong><em># dcp &lt;generated public key&gt;<\/em><\/strong><\/p>\n\n\n\n<p><br>It may look a little strange at first, but it is actually very easy. <\/p>\n\n\n\n<p>For the purpose of this tutorial, I have two hosts \u2013 user_1 and user_2. I will send file called video.mp4 from user_1 to user_2.<\/p>\n\n\n\n<p> Sending the file from  <strong>user_1 <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong><em># dcp video.mp4<\/em><\/strong><br><\/pre>\n\n\n\n<p> In the end of the output, you will see a blue line, which will be dcp&nbsp;<code>&lt;generated public key&gt;<\/code>: <\/p>\n\n\n\n<p>You can then use the following command to obtain the file from another host. <\/p>\n\n\n\n<p>In the below example, I will download the file from&nbsp;<strong>user_2<\/strong>:<\/p>\n\n\n\n<p><strong><em># dcp c3233d5f3cca81be7cd080712013dd77bd7ebfd4bcffcQ12121cbeacf9c7de89b<\/em><\/strong><\/p>\n\n\n\n<p>That\u2019s it, the file has been downloaded.<\/p>\n\n\n\n<p><strong>Dcp<\/strong>&nbsp;has some extra options you can run it with:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>-r, --recursive<\/code>&nbsp;\u2013 recursively copy directories.<\/li><li><code>-n, --dry-run<\/code>&nbsp;\u2013 show what files would have been copied.<\/li><li><code>--skip-prompt<\/code>&nbsp;\u2013 automatically download without a prompt.<\/li><li><code>-v, --verbose<\/code>&nbsp;\u2013 verbose mode \u2013 prints extra debugging messages.<\/li><\/ul>\n\n\n\n<p>We hope you\u2019ve found this useful!<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description We often need to copy or share files over the network. Many of us are used to using tools such as rsync&nbsp;or&nbsp;scp to transfer files between machines. In this tutorial, we are going to review another tool that can help you copy files between hosts in a network \u2013&nbsp;Dat Copy&nbsp;(dcp). Dcp&nbsp;does not require SSH [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1385,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1381","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-categorized"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1381"}],"version-history":[{"count":2,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1381\/revisions"}],"predecessor-version":[{"id":1388,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1381\/revisions\/1388"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1385"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}