{"id":4599,"date":"2018-01-09T07:36:40","date_gmt":"2018-01-09T07:36:40","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=4599"},"modified":"2021-02-27T09:09:45","modified_gmt":"2021-02-27T09:09:45","slug":"how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/","title":{"rendered":"How To scp, ssh and rsync without prompting for password using OpenSSH"},"content":{"rendered":"<p><strong>Verify that local-host and remote-host is running openSSH<\/strong><br \/>\n<em>ssh -V<\/em><br \/>\n<em>OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006<\/em><\/p>\n<p><strong>Lets say you want to copy between two hosts host_src and host_dest. host_src is the host where you would run the scp, ssh or rsyn command, irrespective of the direction of the file copy!<\/strong><br \/>\n<strong>1.<\/strong>\u00a0On host_src, run this command as the user that runs scp\/ssh\/rsync<br \/>\n$ ssh-keygen -t rsa<br \/>\nThis will prompt for a passphrase. Just press the enter key. It&#8217;ll then generate an identification (private key) and a public key. Do not ever share the private key with anyone! ssh-keygen shows where it saved the public key. This is by default ~\/.ssh\/id_rsa.pub:<br \/>\nYour public key has been saved in &lt;your_home_dir&gt;\/.ssh\/id_rsa.pub<\/p>\n<p><strong>2.<\/strong>\u00a0Transfer the id_rsa.pub file to host_dest by either ftp, scp, rsync or any other method.<\/p>\n<p><strong>3.<\/strong>\u00a0On host_dest, login as the remote user which you plan to use when you run scp, ssh or rsync on host_src.<\/p>\n<p><strong>4.<\/strong>\u00a0Copy the contents of id_rsa.pub to ~\/.ssh\/authorized_keys<br \/>\n$ cat id_rsa.pub &gt;&gt;~\/.ssh\/authorized_keys<br \/>\n$ chmod 700 ~\/.ssh\/authorized_keys<br \/>\nIf this file does not exists, then the above command will create it. Make sure you remove permission for others to read this file. If its a public key, why prevent others from reading this file? Probably, the owner of the key has distributed it to a few trusted users and has not placed any additional security measures to check if its really a trusted user.<\/p>\n<p><strong>5.<\/strong>\u00a0Note that ssh by default does not allow root to log in. This has to be explicitly enabled on host_dest. This can be done by editing \/etc\/ssh\/sshd_config and changing the option of PermitRootLogin from no to yes. Don&#8217;t forget to restart sshd so that it reads the modified config file. Do this only if you want to use the root login.<\/p>\n<p><strong>Putty using Windows:<\/strong><\/p>\n<p>If you are trying using windows, you can use puttygen to generate public\/private keys and do the configuration in putty as in image below to connect to other server&#8230;<\/p>\n<p>&nbsp;<\/p>\n<p>PIC TO BE UPLOADED&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Reference.<\/strong><br \/>\n<a href=\"http:\/\/www.thegeekstuff.com\/2008\/10\/perform-ssh-and-scp-without-password-from-ssh2-to-openssh\/\" rel=\"nofollow\">http:\/\/www.thegeekstuff.com\/2008\/10\/perform-ssh-and-scp-without-password-from-ssh2-to-openssh\/<\/a><br \/>\n<a href=\"http:\/\/blogs.oracle.com\/jkini\/entry\/how_to_scp_scp_and\" rel=\"nofollow\">http:\/\/blogs.oracle.com\/jkini\/entry\/how_to_scp_scp_and<\/a><br \/>\n<a href=\"http:\/\/www.thegeekstuff.com\/2008\/06\/perform-ssh-and-scp-without-entering-password-on-openssh\/\" rel=\"nofollow\">http:\/\/www.thegeekstuff.com\/2008\/06\/perform-ssh-and-scp-without-entering-password-on-openssh\/<\/a><br \/>\n<a href=\"http:\/\/www.csua.berkeley.edu\/~ranga\/notes\/ssh_nopass.html\" rel=\"nofollow\">http:\/\/www.csua.berkeley.edu\/~ranga\/notes\/ssh_nopass.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Verify that local-host and remote-host is running openSSH ssh -V OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006 Lets say you want [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[66],"tags":[4521,534,566,4520,896],"class_list":["post-4599","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-openssh","tag-password","tag-rsync","tag-scp","tag-ssh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To scp, ssh and rsync without prompting for password using OpenSSH - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To scp, ssh and rsync without prompting for password using OpenSSH - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Verify that local-host and remote-host is running openSSH ssh -V OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006 Lets say you want [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-09T07:36:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-27T09:09:45+00:00\" \/>\n<meta name=\"author\" content=\"scmgalaxy K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"scmgalaxy K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/\"},\"author\":{\"name\":\"scmgalaxy K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"headline\":\"How To scp, ssh and rsync without prompting for password using OpenSSH\",\"datePublished\":\"2018-01-09T07:36:40+00:00\",\"dateModified\":\"2021-02-27T09:09:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/\"},\"wordCount\":416,\"commentCount\":0,\"keywords\":[\"OpenSSH\",\"password\",\"Rsync\",\"scp\",\"SSH\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/\",\"name\":\"How To scp, ssh and rsync without prompting for password using OpenSSH - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2018-01-09T07:36:40+00:00\",\"dateModified\":\"2021-02-27T09:09:45+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To scp, ssh and rsync without prompting for password using OpenSSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\",\"name\":\"scmgalaxy K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"caption\":\"scmgalaxy K\"},\"sameAs\":[\"http:\\\/\\\/www.DevOpsSchool.com\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/scmgalaxy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To scp, ssh and rsync without prompting for password using OpenSSH - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/","og_locale":"en_US","og_type":"article","og_title":"How To scp, ssh and rsync without prompting for password using OpenSSH - scmGalaxy","og_description":"Verify that local-host and remote-host is running openSSH ssh -V OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006 Lets say you want [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/","og_site_name":"scmGalaxy","article_published_time":"2018-01-09T07:36:40+00:00","article_modified_time":"2021-02-27T09:09:45+00:00","author":"scmgalaxy K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"scmgalaxy K","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/"},"author":{"name":"scmgalaxy K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"headline":"How To scp, ssh and rsync without prompting for password using OpenSSH","datePublished":"2018-01-09T07:36:40+00:00","dateModified":"2021-02-27T09:09:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/"},"wordCount":416,"commentCount":0,"keywords":["OpenSSH","password","Rsync","scp","SSH"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/","name":"How To scp, ssh and rsync without prompting for password using OpenSSH - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2018-01-09T07:36:40+00:00","dateModified":"2021-02-27T09:09:45+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-scp-ssh-and-rsync-without-prompting-for-password-using-openssh\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How To scp, ssh and rsync without prompting for password using OpenSSH"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102","name":"scmgalaxy K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","caption":"scmgalaxy K"},"sameAs":["http:\/\/www.DevOpsSchool.com"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/scmgalaxy\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/4599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=4599"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/4599\/revisions"}],"predecessor-version":[{"id":4600,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/4599\/revisions\/4600"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=4599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=4599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=4599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}