{"id":404,"date":"2011-01-31T05:52:46","date_gmt":"2011-01-31T11:52:46","guid":{"rendered":"http:\/\/blog.supportpro.com\/2011\/01\/how-to-do-rsync-with-a-non-standard-ssh-port\/"},"modified":"2026-01-08T04:26:44","modified_gmt":"2026-01-08T10:26:44","slug":"how-to-do-rsync-with-a-non-standard-ssh-port","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/how-to-do-rsync-with-a-non-standard-ssh-port\/","title":{"rendered":"How to do Rsync with a non-standard ssh port ?"},"content":{"rendered":"<p data-start=\"200\" data-end=\"536\">Rsync is a powerful and widely used tool for copying and synchronizing files between servers. It is commonly used by system administrators because it is fast, secure, and reliable. By default, rsync connects to remote servers using SSH on port 22. However, many servers are configured to use a non-standard SSH port for better security.<\/p>\n<p data-start=\"538\" data-end=\"645\">In such cases, rsync can still be used without any issues by specifying the custom SSH port in the command.<\/p>\n<h2 data-start=\"652\" data-end=\"686\">Why Use a Non-Standard SSH Port<\/h2>\n<p data-start=\"688\" data-end=\"1005\">Many administrators change the default SSH port to reduce unauthorized access and automated attacks. When a server uses a custom port, tools that rely on SSH must be told which port to use. Rsync supports this easily through command-line options, allowing secure file transfers without changing server configurations.<\/p>\n<h2 data-start=\"1012\" data-end=\"1057\">Rsync Command with a Non-Standard SSH Port<\/h2>\n<p data-start=\"1059\" data-end=\"1206\">To use rsync with a custom SSH port, you need to specify the port using the <code data-start=\"1135\" data-end=\"1139\">-e<\/code> option. This option tells rsync which remote shell command to use.<\/p>\n<p data-start=\"1208\" data-end=\"1224\">Example command:<\/p>\n<div class=\"contain-inline-size rounded-2xl corner-superellipse\/1.1 relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-[calc(--spacing(9)+var(--header-height))] @w-xl\/main:top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\"><strong>rsync -avz -e &#8220;ssh -p $portNumber&#8221; user@destinationserverIP:\/filespath \/path_to_local\/<\/strong><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><\/div>\n<\/div>\n<p data-start=\"1312\" data-end=\"1520\">Replace <code data-start=\"1320\" data-end=\"1326\">PORT<\/code> with the actual SSH port number, such as <code data-start=\"1368\" data-end=\"1374\">2222<\/code>.<br data-start=\"1375\" data-end=\"1378\" \/>This command securely connects to the remote server and copies files to the local system while preserving permissions and directory structure.<\/p>\n<h2 data-start=\"1527\" data-end=\"1551\">How the Command Works<\/h2>\n<ul data-start=\"1553\" data-end=\"1776\">\n<li data-start=\"1553\" data-end=\"1612\">\n<p data-start=\"1555\" data-end=\"1612\"><strong data-start=\"1555\" data-end=\"1561\">-a<\/strong> enables archive mode to preserve file attributes<\/p>\n<\/li>\n<li data-start=\"1613\" data-end=\"1668\">\n<p data-start=\"1615\" data-end=\"1668\"><strong data-start=\"1615\" data-end=\"1621\">-v<\/strong> provides detailed output during the transfer<\/p>\n<\/li>\n<li data-start=\"1669\" data-end=\"1721\">\n<p data-start=\"1671\" data-end=\"1721\"><strong data-start=\"1671\" data-end=\"1677\">-z<\/strong> compresses data to improve transfer speed<\/p>\n<\/li>\n<li data-start=\"1722\" data-end=\"1776\">\n<p data-start=\"1724\" data-end=\"1776\"><strong data-start=\"1724\" data-end=\"1744\">-e &#8220;ssh -p PORT&#8221;<\/strong> specifies the custom SSH port<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"1778\" data-end=\"1860\">Once the correct port is provided, rsync behaves exactly like a standard transfer.<\/p>\n<h2 data-start=\"1867\" data-end=\"1912\">Benefits of Using Rsync with a Custom Port<\/h2>\n<p data-start=\"1914\" data-end=\"2224\">Using rsync with a non-standard SSH port allows administrators to follow existing security policies without limiting functionality. File transfers remain encrypted, efficient, and reliable. Rsync continues to support incremental transfers, meaning only changed files are copied, which saves time and bandwidth.<\/p>\n<h2 data-start=\"2231\" data-end=\"2250\">Common Use Cases<\/h2>\n<ul data-start=\"2252\" data-end=\"2395\">\n<li data-start=\"2252\" data-end=\"2293\">\n<p data-start=\"2254\" data-end=\"2293\">Server-to-server file synchronization<\/p>\n<\/li>\n<li data-start=\"2294\" data-end=\"2321\">\n<p data-start=\"2296\" data-end=\"2321\">Secure backups over SSH<\/p>\n<\/li>\n<li data-start=\"2322\" data-end=\"2363\">\n<p data-start=\"2324\" data-end=\"2363\">Website or application data migration<\/p>\n<\/li>\n<li data-start=\"2364\" data-end=\"2395\">\n<p data-start=\"2366\" data-end=\"2395\">Remote log or data transfer<\/p>\n<\/li>\n<\/ul>\n<h2 data-start=\"2402\" data-end=\"2415\">Conclusion<\/h2>\n<p data-start=\"2417\" data-end=\"2756\">Rsync works seamlessly with non-standard SSH ports when the correct options are used. By specifying the SSH port directly in the command, administrators can securely synchronize files without modifying SSH configuration files. This makes rsync a flexible and trusted solution for secure file transfers across different server environments.<\/p>\n<p data-start=\"2758\" data-end=\"2896\">If you need assistance configuring or running rsync commands, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">SupportPRO Server Admin<\/a>\u00a0is available to help with expert server support.<\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rsync is a powerful and widely used tool for copying and synchronizing files between servers. It is commonly used by system administrators because it is fast, secure, and reliable. By&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=404"}],"version-history":[{"count":9,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/404\/revisions"}],"predecessor-version":[{"id":15122,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/404\/revisions\/15122"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}