{"id":212690,"date":"2020-06-07T23:02:51","date_gmt":"2020-06-07T20:02:51","guid":{"rendered":"https:\/\/shop.thekernel.ua\/using-yubikey-with-macos\/"},"modified":"2024-09-17T14:45:59","modified_gmt":"2024-09-17T11:45:59","slug":"using-yubikey-with-macos","status":"publish","type":"post","link":"https:\/\/shop.thekernel.ua\/en\/using-yubikey-with-macos","title":{"rendered":"How to set up a YubiKey with a macOS account"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.17.1&#8243; background_image=&#8221;https:\/\/shop.thekernel.ua\/wp-content\/uploads\/2019\/05\/Security-Key-NFC-by-Yubico-Laptop-1030&#215;687.jpg&#8221; parallax=&#8221;on&#8221; min_height=&#8221;610px&#8221; custom_margin=&#8221;-160px||-3px||false|false&#8221; custom_padding=&#8221;37px||22px|||&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row custom_padding_last_edited=&#8221;on|phone&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; width_tablet=&#8221;&#8221; width_phone=&#8221;92%&#8221; width_last_edited=&#8221;on|desktop&#8221; custom_margin=&#8221;|auto|0px|auto|false|false&#8221; custom_padding=&#8221;146px||0px|||&#8221; custom_padding_tablet=&#8221;0px||||false|false&#8221; custom_padding_phone=&#8221;84px||||false|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; text_font=&#8221;|900|||||||&#8221; text_text_color=&#8221;#ffffff&#8221; text_font_size=&#8221;65px&#8221; text_letter_spacing=&#8221;2px&#8221; text_line_height=&#8221;1.8em&#8221; header_font=&#8221;|800|||||||&#8221; header_text_color=&#8221;#ffffff&#8221; header_font_size=&#8221;65px&#8221; header_letter_spacing=&#8221;2px&#8221; header_line_height=&#8221;1.8em&#8221; text_orientation=&#8221;center&#8221; custom_margin=&#8221;0px||||false|false&#8221; custom_margin_phone=&#8221;0px||||false|false&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; text_font_size_tablet=&#8221;49px&#8221; text_font_size_phone=&#8221;38px&#8221; text_font_size_last_edited=&#8221;on|tablet&#8221; text_line_height_tablet=&#8221;1.8em&#8221; text_line_height_phone=&#8221;1.8em&#8221; text_line_height_last_edited=&#8221;on|desktop&#8221; header_font_size_tablet=&#8221;&#8221; header_font_size_phone=&#8221;38px&#8221; header_font_size_last_edited=&#8221;on|desktop&#8221; text_text_shadow_style=&#8221;preset1&#8243; header_text_shadow_style=&#8221;preset1&#8243; text_text_align=&#8221;center&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h1>Using YubiKey with macOS<\/h1>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16&#8243; background_color=&#8221;#f2f2f2&#8243; custom_margin=&#8221;|0px||0px|false|false&#8221; custom_padding=&#8221;|0px||0px|false|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; width_tablet=&#8221;91%&#8221; width_phone=&#8221;92%&#8221; width_last_edited=&#8221;on|tablet&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; header_2_text_color=&#8221;#111&#8243; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2 style=\"text-align: center;\">How to set up a YubiKey with macOS?<\/h2>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; text_text_color=&#8221;#333333&#8243; text_font_size=&#8221;18px&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<p style=\"text-align: center;\">With hardware security keys, you can get the additional protection of two-factor authentication to make your login procedure secure. Follow these step-by-step instructions to easily set up a YubiKey with macOS.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; width=&#8221;92%&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.17.1&#8243; text_text_color=&#8221;#333&#8243; text_font_size=&#8221;16px&#8221; header_text_color=&#8221;#111&#8243; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h3 id=\"top\">Content<\/h3>\n<ul>\n<li><a href=\"#compatible_yubikeys\">Applicable YubiKey<\/a><\/li>\n<li><a href=\"#introduction\">Introduction<\/a><\/li>\n<li><a href=\"#installation\">Installation<\/a><\/li>\n<li><a href=\"#configuration\">Configuration<\/a>\n<ul>\n<li><a href=\"#yubikey_configuration\">Configuring Your YubiKeys<\/a><\/li>\n<li><a href=\"#adding_yubikey\">Associating Your YubiKeys with Your Account<\/a><\/li>\n<li><a href=\"#testing_configuration\">Testing the Configuration<\/a><\/li>\n<li><a href=\"#enabling_configuration\">Enabling the Configuration<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#troubleshooting\">Troubleshooting<\/a><\/li>\n<li><a href=\"#uninstall_pam\">Uninstalling the macOS Login Tool<\/a><\/li>\n<li><a href=\"#notes\">Notes<\/a><\/li>\n<\/ul>\n<h2 id=\"compatible_yubikeys\" style=\"display: inline;\">Applicable YubiKey<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><a href=\"#top\">(Up)<\/a><\/span><br \/>\nYubiKey 5 NFC, YubiKey 5 Nano, YubiKey 5C, YubiKey 5C Nano, YubiKey NEO, YubiKey 4, YubiKey 4 Nano, YubiKey 4, YubiKey 4C Nano.<\/p>\n<h2 id=\"introduction\" style=\"display: inline;\">Introduction<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><a href=\"#top\">(Up)<\/a><\/span><br \/>\nThe macOS Login Tool allows for secure two-factor authentication on Macs using the HMAC-SHA1 challenge-response feature of the YubiKey.<\/p>\n<p><strong>Note:<\/strong> Enabling full disk encryption (FDE) with FileVault is highly recommended when using the macOS Login Tool. If you do not enable FDE, it is possible to reboot the Mac into recovery mode and disable the 2FA requirement.<\/p>\n<h2 id=\"installation\" style=\"display: inline;\">Installation<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><br \/>\n<a href=\"#top\">(Up)<\/a><br \/>\n<\/span><\/p>\n<ol>\n<li>Download the <a href=\"https:\/\/www.yubico.com\/products\/services-software\/download\/computer-logon-tools\/\">Yubico PAM<\/a>.<\/li>\n<li>Double-click the downloaded .pkg file to start the installation.<\/li>\n<li>Click <strong>Continue<\/strong>.<\/li>\n<li>Click <strong>Install<\/strong>.<\/li>\n<li>When prompted, enter your password or use Touch ID to confirm the installation.<\/li>\n<li>Click<strong>Close<\/strong>to exit the installation wizard.<\/li>\n<\/ol>\n<h2 id=\"configuration\" style=\"display: inline;\">Configuration<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><br \/>\n<a href=\"#top\">(Up)<\/a><br \/>\n<\/span><\/p>\n<h3>Configuring Your YubiKeys<\/h3>\n<p>You will need software to set up <a href=\"https:\/\/www.yubico.com\/products\/services-software\/download\/yubikey-manager\/\">YubiKey Manager<\/a>.<\/p>\n<ol>\n<li>Open YubiKey Manager.<\/li>\n<li>Insert your YubiKey to an available USB port on your Mac.<\/li>\n<li>Click <strong>Applications<\/strong>, then <strong>OTP<\/strong>.<\/li>\n<li>Under <strong>Long Touch (Slot 2)<\/strong>click <strong>Configure<\/strong>.<\/li>\n<li>Select <strong>Challenge-response<\/strong> and click <strong>Next<\/strong>.<\/li>\n<li>Click <strong>Generate<\/strong>, to generate a new secret.<\/li>\n<li>(<em>Optional<\/em>) Check the<strong>Require touch<\/strong>option if you want to require a touch to the metal contact on the YubiKey to approve challenge-response actions.<\/li>\n<li>Click <strong>Finish<\/strong>.<\/li>\n<\/ol>\n<p>Repeat these steps for any additional YubiKeys that you want to use. It is highly recommended to set up a spare YubiKey in order to be able to access your Mac in case the main YubiKey is lost or broken.<\/p>\n<h3 id=\"adding_yubikey\" style=\"display: inline;\">Associating Your YubiKeys with Your Account<\/h3>\n<p><span style=\"display: inline; font-size: 12;\"><br \/>\n<a href=\"#top\">(Up)<\/a><br \/>\n<\/span><\/p>\n<ol>\n<li>Open <strong>Terminal<\/strong>.<\/li>\n<li>Insert your YubiKey to an available USB port on your Mac.<\/li>\n<li>Run the command: <span class=\"term\">ykpamcfg -2.<\/span>\n<ul>\n<li>If you previously checked the <strong>Require touch<\/strong> option, then when the indicator on the YubiKey starts flashing, touch the sensor button on the key.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>Repeat these steps for any additional YubiKeys that you want to use.<\/p>\n<p><strong>Note:<\/strong> If you receive an error similar to<span class=\"term\">File \/Users\/username\/.yubico\/challenge-7122584 already exists, refusing to overwrite<\/span>this indicates you have already associated this YubiKey with your account. If you are reconfiguring the YubiKey with a new challenge-response secret, you need to delete this file before running the <span class=\"term\">ykpamcfg -2<\/span>command.<\/p>\n<h3 id=\"testing_configuration\" style=\"display: inline;\">Testing the Configuration<\/h3>\n<p><span style=\"display: inline; font-size: 12;\"><a href=\"#top\">(Up)<\/a><\/span><br \/>\nBefore you enable mandatory two-factor authentication on your Mac, you should verify that the configuration works. This is achieved by enabling the requirement only for the screensaver first; if something goes wrong and it does not work you can reboot your Mac and log in normally with just your password.<\/p>\n<p>To get started, make sure your Mac is set to require a password as soon as the screen saver starts.<\/p>\n<ol>\n<li>Open <strong>System Preferences<\/strong>.<\/li>\n<li>Click <strong>Security &amp; Privacy<\/strong>.<\/li>\n<li>Click on the <strong>General<\/strong> tab.<\/li>\n<li>Check the <strong>Require password<\/strong> option and select <strong>immediately<\/strong>.<\/li>\n<\/ol>\n<p>Now the Mac can be configured to require two-factor authentication for the screensaver.<\/p>\n<ol>\n<li>Open <strong>Terminal<\/strong>.<\/li>\n<li>Run: <span class=\"term\">sudo nano \/etc\/pam.d\/screensaver<\/span><\/li>\n<li>When prompted, type your password and press <strong>Enter<\/strong>.<\/li>\n<li>Add the line below above the <span class=\"term\">account required pam_opendirectory.so<\/span> line.<\/li>\n<\/ol>\n<p><code class=\"bash\">auth       required       \/usr\/local\/lib\/security\/pam_yubico.so mode=challenge-response<\/code><\/p>\n<ol start=\"5\">\n<li>Press <strong>Ctrl+X<\/strong>, <strong>Y<\/strong>, and then <strong>Enter<\/strong>, to save the file.<\/li>\n<\/ol>\n<p>To test the configuration, press <strong>Command+Ctrl+Q<\/strong> to lock the Mac. Make sure your YubiKey is not plugged in to the Mac and attempt to login; you should not be able to login, even with the correct password. Then plug in the YubiKey and make sure you can log in after entering the correct password.<\/p>\n<h3 id=\"enabling_configuration\" style=\"display: inline;\">Enabling the Configuration<\/h3>\n<p><span style=\"display: inline; font-size: 12;\"><a href=\"#top\">(Up)<\/a><\/span><br \/>\nOnce you&#8217;ve verified that the configuration works, follow the step-by-step instructions below to enable two-factor authentication for the login screen, as well as for the screen saver.<\/p>\n<ol>\n<li>Open <strong>Terminal<\/strong>.<\/li>\n<li>Run: <span class=\"term\">sudo nano \/etc\/pam.d\/authorization<\/span><\/li>\n<li>When prompted, type your password and press <strong>Enter<\/strong>.<\/li>\n<li>Add the line below above the <span class=\"term\">account required pam_opendirectory.so<\/span> line.<\/li>\n<\/ol>\n<p><code class=\"bash\">auth       required       \/usr\/local\/lib\/security\/pam_yubico.so mode=challenge-response<\/code><\/p>\n<ol start=\"5\">\n<li>Press <strong>Ctrl+X<\/strong>, <strong>Y<\/strong>, and then <strong>Enter<\/strong>, to save the file.<\/li>\n<\/ol>\n<h2 id=\"troubleshooting\" style=\"display: inline;\">Troubleshooting<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><a href=\"#top\">(Up)<\/a><\/span><br \/>\nIf you run into issues with the macOS Login Tool after following this guide, you can follow the steps below to enable debug logging, which will provide insight into the issue.<\/p>\n<ol>\n<li>Open <strong>Terminal<\/strong>.<\/li>\n<li>Run: <span class=\"term\">sudo touch \/var\/log\/pam_yubico.log<\/span><\/li>\n<li>Run: <span class=\"term\">sudo chmod 766 \/var\/log\/pam_yubico.log<\/span><\/li>\n<li>Run:<span class=\"term\">sudo sed -i &#8220;.yubibak&#8221; -E &#8220;s\/^auth.+pam_yubico\\.so.+mode=challenge-response\/&amp; debug debug_file=\\\/var\\\/log\\\/pam_yubico.log\/&#8221; \/etc\/pam.d\/screensaver<\/span><\/li>\n<li>Run:<span class=\"term\">sudo sed -i &#8220;.yubibak&#8221; -E &#8220;s\/^auth.+pam_yubico\\.so.+mode=challenge-response\/&amp; debug debug_file=\\\/var\\\/log\\\/pam_yubico.log\/&#8221; \/etc\/pam.d\/authorization<\/span><\/li>\n<li>Attempt to login with the YubiKey plugged in to your Mac.<\/li>\n<\/ol>\n<p>You can analyze the \/<span class=\"term\">var\/log\/pam_yubico.log<\/span> file to see where the issue is. Or contact <a href=\"https:\/\/support.yubico.com\/support\/tickets\/new\">Yubico support<\/a> and submit the log data.<\/p>\n<h2 id=\"uninstall_pam\" style=\"display: inline;\">Uninstalling the macOS Login Tool<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><a href=\"#top\">(Up)<\/a><\/span><br \/>\nYou can use the script in the <a href=\"https:\/\/support.yubico.com\/helpdesk\/attachments\/15006267616\">Uninstalling the macOS Login Tool<\/a>article to uninstall the tool from your Mac.<\/p>\n<ol>\n<li>Open <strong>Terminal<\/strong>.<\/li>\n<li>Run: <span class=\"term\">cd ~\/Downloads<\/span><\/li>\n<li>Run: <span class=\"term\">sudo bash uninstall-maclogintool.sh<\/span><\/li>\n<li>When prompted, press <strong>Enter<\/strong> to confirm the deletion.<\/li>\n<\/ol>\n<h2 id=\"notes\" style=\"display: inline;\">Notes<\/h2>\n<p><span style=\"display: inline; font-size: 12;\"><br \/>\n<a href=\"#top\">(Up)<\/a><br \/>\n<\/span><\/p>\n<ul>\n<li>Enabling the macOS Login Tool is a system-wide change and will affect all accounts on the Mac.<\/li>\n<li>If Touch ID is enabled, login will be done without Yubico PAM. Due to how Touch ID was implemented.<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; fullwidth=&#8221;on&#8221; _builder_version=&#8221;4.17.1&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_fullwidth_post_slider include_categories=&#8221;current&#8221; _builder_version=&#8221;4.21.0&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;RGBA(255,255,255,0)&#8221; background_image=&#8221;https:\/\/shop.thekernel.ua\/wp-content\/uploads\/2022\/04\/090f3141-scaled.jpg&#8221; custom_margin=&#8221;||-85px||false|false&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_fullwidth_post_slider][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using YubiKey with macOS How to set up a YubiKey with macOS? With hardware security keys, you can get the additional protection of two-factor authentication to make your login procedure secure. Follow these step-by-step instructions to easily set up a YubiKey with macOS. Content Applicable YubiKey Introduction Installation Configuration Configuring Your YubiKeys Associating Your YubiKeys [&hellip;]<\/p>\n","protected":false},"author":42,"featured_media":245852,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"Find out how to set up YubiKey with macOS for seamless security integration. Protect your Apple devices with this trusted solution.","_seopress_robots_index":"","_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[402],"tags":[],"class_list":["post-212690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-settings"],"acf":[],"_links":{"self":[{"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/posts\/212690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/comments?post=212690"}],"version-history":[{"count":7,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/posts\/212690\/revisions"}],"predecessor-version":[{"id":245855,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/posts\/212690\/revisions\/245855"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/media\/245852"}],"wp:attachment":[{"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/media?parent=212690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/categories?post=212690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shop.thekernel.ua\/en\/wp-json\/wp\/v2\/tags?post=212690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}