{"id":5543,"date":"2023-12-05T17:08:00","date_gmt":"2023-12-05T23:08:00","guid":{"rendered":"https:\/\/www.incredigeek.com\/home\/?p=5543"},"modified":"2023-12-06T11:21:47","modified_gmt":"2023-12-06T17:21:47","slug":"copy-ssh-keys-to-server-with-sftp","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/copy-ssh-keys-to-server-with-sftp\/","title":{"rendered":"Copy SSH Keys to Server with SFTP"},"content":{"rendered":"\n<p><em>These steps assume you already have a public SSH key, if not, <a href=\"https:\/\/www.incredigeek.com\/home\/setting-up-ssh-keys-in-linux\/\" data-type=\"post\" data-id=\"962\">create one<\/a><\/em><\/p>\n\n\n\n<p><em><a href=\"https:\/\/www.incredigeek.com\/home\/setting-up-ssh-keys-in-linux\/\" data-type=\"post\" data-id=\"951\">SSH-Copy-Id<\/a> is an easier way to upload ssh keys, however, it does not work on all devices.<\/em><\/p>\n\n\n\n<p>ssh to the remote server using your password.<\/p>\n\n\n\n<p>If it is not already created, create the authorized_keys file under the .ssh folder<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">touch ~\/.ssh\/authorized_keys\n\nchmod 600 ~\/.ssh\/authorized_keys\n\nvi ~\/.ssh\/authorized_keys<\/pre>\n\n\n\n<p>Add your public key to the end of the authorized_keys file<\/p>\n\n\n\n<p>Ensure that the correct owner and permissions are on the files.<\/p>\n\n\n\n<p>The .ssh directory should be <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chmod 700 .ssh<\/pre>\n\n\n\n<p>And the authorized_keys file should be 600<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chmod 600 ~\/.ssh\/authorized_keys<\/pre>\n\n\n\n<p>Both should be owned by the user.  Change username to your username.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo chown -R username:username .ssh\/authorized_keys<\/pre>\n\n\n\n<p>Helpful links<\/p>\n\n\n\n<p><a href=\"https:\/\/blog.tinned-software.net\/setup-sftp-only-account-using-openssh-and-ssh-key\/\">https:\/\/blog.tinned-software.net\/setup-sftp-only-account-using-openssh-and-ssh-key\/<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/blog.tinned-software.net\/ssh-passwordless-login-with-ssh-key\/\">https:\/\/blog.tinned-software.net\/ssh-passwordless-login-with-ssh-key\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These steps assume you already have a public SSH key, if not, create one SSH-Copy-Id is an easier way to upload ssh keys, however, it does not work on all devices. ssh to the remote server using your password. If &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/copy-ssh-keys-to-server-with-sftp\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1601,7,1603,341,221,1600],"class_list":["post-5543","post","type-post","status-publish","format-standard","hentry","category-linux","tag-authorized_keys","tag-linux-2","tag-public","tag-sftp","tag-ssh","tag-ssh-copy-id"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/5543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=5543"}],"version-history":[{"count":1,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/5543\/revisions"}],"predecessor-version":[{"id":5544,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/5543\/revisions\/5544"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=5543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=5543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=5543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}