{"id":11097,"date":"2024-06-13T14:28:02","date_gmt":"2024-06-13T14:28:02","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=11097"},"modified":"2024-06-13T14:28:03","modified_gmt":"2024-06-13T14:28:03","slug":"how-to-enable-password-authentication-in-ubuntu-22","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/","title":{"rendered":"How to enable Password authentication in Ubuntu 22?"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># Step 1: Ensure OpenSSH Server is Installed\r\nsudo apt update\r\nsudo apt install openssh-server\r\n\r\n# Step 2: Edit the SSH Configuration File\r\nsudo nano \/etc\/ssh\/sshd_config\r\n\r\n# Ensure the following lines are present and uncommented:\r\n# PasswordAuthentication yes\r\n# UsePAM yes\r\n\r\n# Ensure these lines are either commented out or set correctly:\r\n# ChallengeResponseAuthentication no\r\n# KbdInteractiveAuthentication no\r\n\r\n# Save the file and exit (Ctrl + X, then Y, and Enter)\r\n\r\nAlso\n--------------------------------------------------------------\nI realized that a file \/etc\/ssh\/sshd_config.d\/50-cloud-init.conf was being referenced in my \/etc\/ssh\/sshd_config, via the following line:\r\n\r\nInclude \/etc\/ssh\/sshd_config.d\/*.conf\r\nthis 50-cloud-init.conf file contained the line:\r\n\r\nPasswordAuthentication yes\r\nI changed the line to:\r\n\r\n#PasswordAuthentication yes\r\nand i restarted the ssh.\r\n\r\nNow it is working, I can access only with the ssh key.\n--------------------------------------------------------------\n\n# Step 3: Restart the SSH Service\r\nsudo systemctl restart ssh\r\n\r\n# Step 4: Verify SSH Service Status\r\nsudo systemctl status ssh\r\n\r\n# Step 5: Check PAM Configuration\r\nsudo nano \/etc\/pam.d\/sshd\r\n\r\n# Ensure it includes the following lines:\r\n# auth       required     pam_unix.so\r\n# account    required     pam_unix.so\r\n# password   required     pam_unix.so\r\n# session    required     pam_unix.so\r\n\r\n# Save the file and exit (Ctrl + X, then Y, and Enter)\r\n\r\n# Step 6: Check User Account and Permissions\r\nsudo passwd -u username  # Replace 'username' with the actual username\r\n\r\n# Step 7: Test SSH Connection Locally\r\nssh username@localhost  # Replace 'username' with the actual username\r\n\r\n# Step 8: Examine SSH Logs\r\nsudo tail -f \/var\/log\/auth.log\r\n\r\n# Step 9: Check SELinux\/AppArmor\r\n\r\n# For SELinux:\r\nsudo setenforce 0\r\n\r\n# For AppArmor:\r\nsudo aa-status\r\nsudo systemctl stop apparmor\r\nsudo systemctl disable apparmor\r\n\r\n# Step 10: Ensure No Conflicting Settings in sshd_config\r\nsudo nano \/etc\/ssh\/sshd_config\r\n\r\n# Check for match blocks:\r\n# Match User anoncvs\r\n#     PasswordAuthentication no\r\n\r\n# Ensure such blocks do not affect the user you are trying to log in with.\r\n# Save the file and exit (Ctrl + X, then Y, and Enter)\r\n\r\n# Step 11: Check SSHD Configuration Syntax\r\nsudo sshd -t\r\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11097","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to enable Password authentication in Ubuntu 22? - 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-enable-password-authentication-in-ubuntu-22\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to enable Password authentication in Ubuntu 22? - scmGalaxy\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2024-06-13T14:28:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-13T14:28:03+00:00\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\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-enable-password-authentication-in-ubuntu-22\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"How to enable Password authentication in Ubuntu 22?\",\"datePublished\":\"2024-06-13T14:28:02+00:00\",\"dateModified\":\"2024-06-13T14:28:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/\"},\"wordCount\":7,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/\",\"name\":\"How to enable Password authentication in Ubuntu 22? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2024-06-13T14:28:02+00:00\",\"dateModified\":\"2024-06-13T14:28:03+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-enable-password-authentication-in-ubuntu-22\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to enable Password authentication in Ubuntu 22?\"}]},{\"@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\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to enable Password authentication in Ubuntu 22? - 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-enable-password-authentication-in-ubuntu-22\/","og_locale":"en_US","og_type":"article","og_title":"How to enable Password authentication in Ubuntu 22? - scmGalaxy","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/","og_site_name":"scmGalaxy","article_published_time":"2024-06-13T14:28:02+00:00","article_modified_time":"2024-06-13T14:28:03+00:00","author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"How to enable Password authentication in Ubuntu 22?","datePublished":"2024-06-13T14:28:02+00:00","dateModified":"2024-06-13T14:28:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/"},"wordCount":7,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/","name":"How to enable Password authentication in Ubuntu 22? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2024-06-13T14:28:02+00:00","dateModified":"2024-06-13T14:28:03+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-enable-password-authentication-in-ubuntu-22\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How to enable Password authentication in Ubuntu 22?"}]},{"@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\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/11097","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=11097"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/11097\/revisions"}],"predecessor-version":[{"id":11098,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/11097\/revisions\/11098"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=11097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=11097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=11097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}