{"id":20367,"date":"2023-10-21T17:42:40","date_gmt":"2023-10-22T00:42:40","guid":{"rendered":"https:\/\/portasftpserver.com\/?p=20367"},"modified":"2024-06-27T09:06:47","modified_gmt":"2024-06-27T16:06:47","slug":"porta-sftp-server-public-key-authentication","status":"publish","type":"post","link":"https:\/\/portasftpserver.com\/porta-sftp-server-public-key-authentication\/","title":{"rendered":"Porta SFTP Server Public Key Authentication"},"content":{"rendered":"\n<p class=\"sera-block-paragraph\">Porta SFTP Server supports multiple authentication options such as username and password and public key authentication. Public key authentication must reside within the SFTP Server perimeter to authenticate the client&#8217;s session with its private keys. This method is a good option to increase security compared to simply using a username and password. That said, this post will show how we can create the private and public key pairs and how these keys are used as credentials to log in to the SFTP Server. Though, to successfully follow the steps for this post, please make sure that you have the following.<\/p>\n\n\n\n<ul class=\"sera-block-list\">\n<li><a href=\"https:\/\/portasftpserver.com\/portable-sftp-server-community-edition\/\" data-type=\"page\" data-id=\"8937\" target=\"_blank\" rel=\"noreferrer noopener\">Porta SFTP Server Free Edition<\/a><\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/winscp.net\/eng\/index.php\" data-type=\"link\" data-id=\"https:\/\/winscp.net\/eng\/index.php\" target=\"_blank\">WinSCP<\/a> (Recommended) or <a rel=\"noreferrer noopener\" href=\"https:\/\/filezilla-project.org\/\" data-type=\"link\" data-id=\"https:\/\/filezilla-project.org\/\" target=\"_blank\">FileZilla<\/a> Client<\/li>\n<\/ul>\n\n\n\n<h2 class=\"sera-block-heading klc-block-heading\">Creating Keypairs With WINSCP<\/h2>\n\n\n\n<p class=\"sera-block-paragraph\">Open\/Run WinCSP Client and under the Tools select the PuTTYgen<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/winscp_putty.png\" alt=\"\" class=\"klc-image-20388\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note. <\/em>This option will show you the form like the image below.<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/winscp_putty_2.png\" alt=\"\" class=\"klc-image-20392\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note. <\/em>Select RSA and Click the &#8220;Generate&#8221; button then make a mouse move (gesture) on the rectangular area to create the key pairs. Once the key pairs are created, you can save the public key and private key and name them the same as your username.<\/p>\n\n\n\n<p class=\"sera-block-paragraph\">Caveat, the public key is the one that you will give to the organization\/individual who owns the SFTP Server (who is sharing the data with you or vice versa). This is because, the private key will be used by the SFTP Client (you), and you do not want to share the private key with anyone. Also, you can set a password to your private key (if you want to). The latter will cause you to enter the password whenever connecting to the SFTP Server of course.<\/p>\n\n\n\n<h2 class=\"sera-block-heading klc-block-heading\">Configure Users Key Pairs WinSCP<\/h2>\n\n\n\n<p class=\"sera-block-paragraph\">Porta SFTP Server looks up the public key based on the user&#8217;s username created. That said, if you are using the software, please make sure to name the <strong>public key<\/strong> the same as the client&#8217;s username. This is also a good practice as this complements more organized files located in the <strong>AUTHORIZED_KEYS <\/strong>folder.<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/winscp_putty_3.png\" alt=\"\" class=\"klc-image-20419\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\">Open\/Run WinSCP, select the user then click &#8220;Edit&#8221; and &#8220;Advanced&#8221;<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/winscp_putty_4.png\" alt=\"\" class=\"klc-image-20423\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note. <\/em>Once you click the &#8220;Advanced&#8221; button, go to the Authentication tree like shown below.<\/p>\n\n\n\n<p class=\"sera-block-paragraph\">Again, as client we should use the .ppk file (private key) as credential to login to SFTP Server.<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/winscp_putty_5.png\" alt=\"\" class=\"klc-image-20426\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note.<\/em> Once you specified the location of your private key, click <strong>OK <\/strong>and <strong>Save<\/strong> to apply the user settings.<\/p>\n\n\n\n<h2 class=\"sera-block-heading klc-block-heading\">Test Locally w\/ WinSCP &amp; Porta SFTP Server<\/h2>\n\n\n\n<p class=\"sera-block-paragraph\">Run then Start Porta SFTP Server<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/SetupCrossPlaform1.png\" alt=\"\" class=\"klc-image-20620\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note. <\/em>If you are testing with Porta SFTP Server locally, please make sure that the server is running.<\/p>\n\n\n\n<p class=\"sera-block-paragraph\">The client should see similar to the following saying that the server is authenticating with the public key.<\/p>\n\n\n\n<figure class=\"klc-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2023\/10\/winscp_putty_7.png\" alt=\"\" class=\"klc-image-20447\"\/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note.<\/em> The private key is used by the client and compared to different attributes such as a key <em>fingerprint <\/em>to the public key given to the server.<\/p>\n\n\n\n<h2 class=\"sera-block-heading\">OpenSSH\/SSH Support (Non-Putty)<\/h2>\n\n\n\n<p class=\"sera-block-paragraph\">For non-putty public key format or if you are using the ssh-keygen from an OpenSSH client, make sure you remove the header and footer of the public key contents.<\/p>\n\n\n\n<figure class=\"sera-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"242\" src=\"https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1-1200x242.png\" alt=\"\" class=\"sera-image-22139\" srcset=\"https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1-1200x242.png 1200w, https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1-585x118.png 585w, https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1-768x155.png 768w, https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1-1536x310.png 1536w, https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1-100x20.png 100w, https:\/\/portasftpserver.com\/sera-uploads\/2024\/06\/image-1.png 1919w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p class=\"sera-block-paragraph\"><em>Note.<\/em> In the future, this will be ignored by Porta SFTP Server automatically. <\/p>\n\n\n\n<h2 class=\"sera-block-heading klc-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"sera-block-paragraph\">So, in this post, we&#8217;ve learned how to create the Public and Private Keypairs using the puTTYGen tool. Also, we see how easy to use the Public Key authentication and configure it with Porta SFTP Server and Private Key for the SFTP client (WinSCP). In addition, we also tested it locally to prove the working settings using the WinSCP Client to connect with our running Porta SFTP Server.<\/p>\n\n\n\n<p class=\"sera-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Porta SFTP Server supports multiple authentication options such as username and password and public key authentication. Public key authentication must reside within the SFTP Server perimeter to authenticate the client&#8217;s session with its private keys. This method is a good option to increase security compared to simply using a username and password. That said, this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":20368,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143,124,253,206],"tags":[210,265,264,263,234],"class_list":["post-20367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computer-protections","category-data-information-security","category-emails-files-security","category-learning-educations","tag-best-portable-sftp-server","tag-how-to-create-rsa-key-pairs","tag-how-to-use-public-key-authentication-with-sftp-server","tag-porta-sftp-server-with-public-key","tag-porta-sftp-server-with-winscp"],"_links":{"self":[{"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/posts\/20367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/comments?post=20367"}],"version-history":[{"count":79,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/posts\/20367\/revisions"}],"predecessor-version":[{"id":22143,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/posts\/20367\/revisions\/22143"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/media\/20368"}],"wp:attachment":[{"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/media?parent=20367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/categories?post=20367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/portasftpserver.com\/sera-json\/wp\/v2\/tags?post=20367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}