{"id":23232,"date":"2020-12-09T10:15:13","date_gmt":"2020-12-09T02:15:13","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&#038;p=23232"},"modified":"2023-01-18T14:11:55","modified_gmt":"2023-01-18T06:11:55","slug":"how-to-securely-transfer-files-via-rsync-and-ssh-on-linux-2","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/how-to-securely-transfer-files-via-rsync-and-ssh-on-linux-2","title":{"rendered":"Transfer Files via rsync and SSH on Linux"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"23232\" class=\"elementor elementor-23232\" data-elementor-post-type=\"kb\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c86b3a3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c86b3a3\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-32aa8b0\" data-id=\"32aa8b0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d66416f elementor-widget elementor-widget-heading\" data-id=\"d66416f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-large\">Transfer Files via rsync and SSH on Linux<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d67e5d4 elementor-widget elementor-widget-text-editor\" data-id=\"d67e5d4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>When it comes to transferring files between systems on the network, there are tons of tools available out there for Linux and Unix users.<\/p><p>Nowadays, the most popular protocols for data transfer are SSH and FTP. However, while FTP is very popular, we would still recommend you to use SSH. This is because it is the most secure way to transfer your files.<\/p><p>There are specialized tools for file transfer over SSH like <em>scp<\/em> and <em>sftp. However,<\/em> none of them has all the features that rsync provides. Furthermore, we can use <strong>rsync<\/strong><strong> for <\/strong><strong>mirroring data, incremental backups, copying files between systems<\/strong>, and so on.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-97ede6d elementor-widget elementor-widget-text-editor\" data-id=\"97ede6d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Before we start, make sure you have the rsync utility installed on both the destination and the source systems. If not, you can install it using your distribution\u2019s package manager:<\/p><p><strong>Ubuntu and Debian:<\/strong><\/p><pre class=\"terminal\"><code class=\"terminal-line\">sudo apt install rsync<\/code><\/pre><p><strong>CentOS and Fedora:<\/strong><\/p><pre class=\"terminal\"><code class=\"terminal-line\">sudo yum install rsync<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6d9372c elementor-widget elementor-widget-text-editor\" data-id=\"6d9372c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Also, you should also have accessed SSH on your computer.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5ad7925 elementor-widget elementor-widget-text-editor\" data-id=\"5ad7925\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Well, here is how to Securely Transfer Files via rsync.\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-444e2bb elementor-widget elementor-widget-image\" data-id=\"444e2bb\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.casbay.com\/guide\/wp-content\/uploads\/2021\/02\/rsync.png\" class=\"attachment-large size-large wp-image-32325\" alt=\"rsync\" srcset=\"https:\/\/www.casbay.com\/guide\/wp-content\/uploads\/2021\/02\/rsync.png 1024w, https:\/\/www.casbay.com\/guide\/wp-content\/uploads\/2021\/02\/rsync-300x169.png 300w, https:\/\/www.casbay.com\/guide\/wp-content\/uploads\/2021\/02\/rsync-768x432.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b63849d elementor-widget elementor-widget-heading\" data-id=\"b63849d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Standard SSH Port:<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7cd1b2e elementor-widget elementor-widget-text-editor\" data-id=\"7cd1b2e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>rsync -avHe ssh\u00a0user@server:\/path\/to\/file\u00a0\/home\/user\/path\/to\/file<\/p><ul><li><strong>user<\/strong>: The username of the remote client through which you\u2019ll be signing into the target (remote) server.<\/li><li><strong>server<\/strong>: The hostname or IP address of the target (remote) server.<\/li><li><strong>\/path\/to\/file<\/strong>: The direction to the file that needs to be downloaded from the target (remote) server. where the <em>file<\/em>\u00a0is the file name.<\/li><li><strong>\/home\/user\/path\/to\/file<\/strong>: The local path where you want to save the downloaded file. From the target (remote) server where the <em>file<\/em>\u00a0is the file name.<\/li><\/ul><p><em>For example:<\/em><\/p><p>rsync -avHe ssh\u00a0adam@web01.adamsserver.com:\/home\/adam\/testfile1 \/home\/localuser\/testfile1<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f26b48d elementor-widget elementor-widget-heading\" data-id=\"f26b48d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Alternate SSH Port:<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e3429e4 elementor-widget elementor-widget-text-editor\" data-id=\"e3429e4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>rsync -avHPe &#8220;ssh -pPORTNUMBER&#8221;\u00a0user@server:\/path\/to\/file\u00a0\/home\/user\/path\/to\/file<\/p><ul><li><strong>PORTNUMBER<\/strong>: The port number for SSH on the target (remote) server.<\/li><li><strong>user<\/strong>: The username of the remote client through which you\u2019ll be logging into the target (remote) server.<\/li><li><strong>server<\/strong>: The hostname or IP address of the target (remote) server.<\/li><li><strong>\/path\/to\/file<\/strong>: The direction to the file that needs to be downloaded from the target (remote) server, where the <em>file<\/em>\u00a0is the file name.<\/li><\/ul><p><em>For example:<\/em><\/p><p>rsync -avHPe &#8220;ssh -p1337&#8221;\u00a0adam@web01.adamsserver.com:\/home\/adam\/testfile1 \/home\/localuser\/testfile1<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5f090cd elementor-widget elementor-widget-text-editor\" data-id=\"5f090cd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Next, here is how to Use These Commands to Securely Upload To a Server.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ecc922d elementor-widget elementor-widget-heading\" data-id=\"ecc922d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Standard SSH Port:<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8a5f87d elementor-widget elementor-widget-text-editor\" data-id=\"8a5f87d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>rsync -avH\u00a0\/home\/user\/path\/to\/file\u00a0-e ssh\u00a0user@server:\/path\/to\/file<\/p><ul><li><strong>\/home\/user\/path\/to\/file<\/strong>: The local path where the file that will be uploaded to the target (remote) server exists, where the <em>file<\/em>\u00a0is the file name.<\/li><li><strong>user<\/strong>: The username of the remote user through which you\u2019ll be logging into the target (remote) server.<\/li><li><strong>server<\/strong>: The hostname or IP address of the target (remote) server.<\/li><li><strong>\/path\/to\/file<\/strong>: The remote path for the file that will be uploaded to the target (remote) server, where the <em>file<\/em>\u00a0is the file name.<\/li><\/ul><p><em>For example:<\/em><\/p><p>rsync -avH \/home\/localuser\/testfile1 -e ssh\u00a0adam@web01.adamsserver.com:\/home\/adam\/testfile1<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3d6a50f elementor-widget elementor-widget-heading\" data-id=\"3d6a50f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Alternate SSH Port:<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-df00e41 elementor-widget elementor-widget-text-editor\" data-id=\"df00e41\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>rsync -avHPe &#8220;ssh -pPORTNUMBER&#8221;\u00a0\/home\/user\/path\/to\/file\u00a0-e ssh\u00a0user@server:\/path\/to\/file<\/p><ul><li><strong>PORTNUMBER<\/strong>: The port number for SSH on the target (remote) server.<\/li><li><strong>\/home\/user\/path\/to\/file<\/strong>: The local path where you want to save the downloaded file. From the target (remote) server where the <em>file<\/em>\u00a0is the file name.<\/li><li><strong>user<\/strong>: The username of the remote client through which you\u2019ll be signing into the target (remote) server.<\/li><li><strong>server<\/strong>: The hostname or IP address of the target (remote) server.<\/li><li><strong>\/path\/to\/file<\/strong>: The direction to the file that needs to be downloaded from the target (remote) server. where the <em>file<\/em>\u00a0is the file name.<\/li><\/ul><p><em>For example:<\/em><\/p><p>rsync -avHPe &#8220;ssh -pPORTNUMBER&#8221; \/home\/localuser\/testfile1 -e ssh\u00a0adam@web01.adamsserver.com:\/home\/adam\/testfile1<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1a1c359 elementor-widget elementor-widget-text-editor\" data-id=\"1a1c359\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Seems like you have just learned about transferring files via rsync and SSH on Linux. What is coming next? For more information about the security tips on operating systems (OS), please click <a href=\"https:\/\/www.casbay.com\/guide\/kb\/how-to-securely-transfer-files-via-rsync-and-ssh-on-linux\"><em>here<\/em><\/a>.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Transfer Files via rsync and SSH on Linux When it comes to transferring files between systems on the network, there are tons of tools available out there for Linux and Unix users. Nowadays, the most popular protocols for data transfer are SSH and FTP. However, while FTP is very popular, we would still recommend you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[60],"kbtag":[106],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23232"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=23232"}],"version-history":[{"count":11,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23232\/revisions"}],"predecessor-version":[{"id":38223,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23232\/revisions\/38223"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=23232"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=23232"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=23232"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=23232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}