{"id":4648,"date":"2025-10-06T10:22:30","date_gmt":"2025-10-06T10:22:30","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4648"},"modified":"2025-10-06T10:22:30","modified_gmt":"2025-10-06T10:22:30","slug":"aws-ec2-instance-swap-to-password-authentication","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4648","title":{"rendered":"AWS EC2 Instance Swap to Password Authentication"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Although you should be using a keypair for SSH authentication (and not exposing to the Internet), if you&#8217;re working with a throw-away or test instance you might just need password authentication to be enabled. Here&#8217;s how!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open the SSH configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Set the line &#8220;PasswordAuthentication&#8221; to &#8220;yes&#8221;. Save and close.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the SSH daemon with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart sshd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create a user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>useradd -s \/bin\/bash -d \/home\/bobsmith\/ -m bobsmith\npasswd bobsmith<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now you can login with username and password.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although you should be using a keypair for SSH authentication (and not exposing to the Internet), if you&#8217;re working with a throw-away or test instance you might just need password authentication to be enabled. Here&#8217;s how! Open the SSH configuration file. Set the line &#8220;PasswordAuthentication&#8221; to &#8220;yes&#8221;. Save and close. Restart the SSH daemon with: &#8230; <a title=\"AWS EC2 Instance Swap to Password Authentication\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4648\" aria-label=\"Read more about AWS EC2 Instance Swap to Password Authentication\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4289,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-4648","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4648"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4648\/revisions"}],"predecessor-version":[{"id":4649,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4648\/revisions\/4649"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4289"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}