Setting up the YubiKey on Ubuntu (Desktop and Server)

Поделиться
HTML-код
  • Опубликовано: 31 окт 2020
  • I've recently had a chance to check out some newer YubiKeys, and decided to make a video on it. In this video, I'll show you how to set up the YubiKey on Linux, with examples that include setting it up on your local laptop/desktop as well as using it to secure OpenSSH to a remote server.
    *⏰ TIME CODES*:
    02:11 - Securing local authentication
    11:57 - Securing remote authentication
    📖 Check out jay's latest book, Mastering Ubuntu Server 3rd Edition.
    Available in the USA late December 2020, and in other countries early January 2021
    ➡️ ubuntuserverbook.com
    🙌 Support me on Patreon and get early access to new content!
    ➡️ learnlinux.link/patron
    ☁️ Get $100 toward your own cloud server with Linode!
    ➡️ linode.com/learnlinuxtv
    🛒 Affiliate store for Linux compatible hardware/accessories (commission earned):
    ➡️ learnlinux.link/amazon
    💻 Check out the Tiny Pilot KVM for your Homelab (commission earned):
    ➡️ learnlinux.link/tinypilot
    📖 Wiki article for this video:
    ➡️ www.learnlinux.tv/setting-up-...
    📖 Yubico documentation for setting up the YubiKey:
    ➡️ support.yubico.com/hc/en-us/a...
    🐦 Follow me on Twitter!
    ➡️ learnlinux.link/twitter
    💬 Official LearnLinux.tv Community:
    ➡️ community.learnlinux.tv
    👨 More about me:
    ➡️ www.jaylacroix.com
    ➡️ www.learnlinux.tv/about-me
    💽 How to create a bootable flash drive for installing Linux:
    ➡️ linux.video/flash-usb
    🐧 Which distro do I use?
    ➡️ learnlinux.link/mydistro
    🔐 How to better secure OpenSSH:
    ➡️ linux.video/secure-ssh
    ☁️ How to create a cloud Linux server with Linode:
    ➡️ learnlinux.link/create-linode
  • НаукаНаука

Комментарии • 114

  • @XXX-XX-X-X
    @XXX-XX-X-X 6 месяцев назад +7

    I love this. Encrypted hard drive, secure boot enabled, yubikey required for everything.... This laptop is going to be the most secure device I own with nothing but factorio on it.

  • @MarkWatsonSMTX
    @MarkWatsonSMTX 2 года назад +14

    This needs to be updated to include multiple keys. If you don't have a backup key and you lose your YubiKey, you're toast. Toast. I have 3.

    • @NickShoup
      @NickShoup Год назад +1

      Have a resource for adding additional keys? Agreed. The yubikey documentation doesn't say much about this.

    • @alikaperdue
      @alikaperdue Год назад +2

      If you lose your key, you could boot that computer entirely on USB or SD. Then mount the drive you secured with yubikey. Edit all the /etc/pam.d files and comment out these lines added here. Then on reboot the key will not be required.
      If your hard drive uses yubikey with LUKS, then you will need to have a written backup password for the drive or all is lost.
      In any case, the key is not much security unless you use it to lock the drive with luks. So everyone should do that. When done, write down a very long text password for a LUKS backup and store it in the bank vault. Otherwise, anyone can bypass the yubikey protections with little effort. I've lost systems to Luks and they never came back.

    • @alikaperdue
      @alikaperdue Год назад +1

      The addition of a second key is described below in comments and it worked for me.

  • @henrik2117
    @henrik2117 2 года назад

    Great video, Jay! Thank you for sharing!

  • @Theferg1
    @Theferg1 3 года назад

    Jay thank you for the video and info!!

  • @gottfriedehmann6046
    @gottfriedehmann6046 7 месяцев назад

    Great video. Managed to make Yubikey runnig on debian 12. Thanks!!!

  • @ChrisFredriksson
    @ChrisFredriksson 2 года назад +3

    So easy and useful! Will try this tomorrow and see how I manage to screw this up 😂 just kidding, I believe I should be able to make it work with your video! Thank you!

  • @grimtrigg3r
    @grimtrigg3r 2 года назад +2

    Great instructional. You've got a great style - no bs, just necessary information. New sub.

  • @KillSwitchI
    @KillSwitchI 3 года назад

    Nicely explained. Thanks.

  • @jaysunkreuze1466
    @jaysunkreuze1466 2 года назад

    Liked this so much I subbed!

  • @PatrickStewarts
    @PatrickStewarts Год назад

    OMG thank you so much! This worked perfectly!

  • @hugorodriguez2586
    @hugorodriguez2586 3 года назад

    Hey Jay! this video is excellent
    Thanks for your teach

  • @user-lk9wy7hi1d
    @user-lk9wy7hi1d 2 года назад

    Thank you! This worked for me :)

  • @guidoserrano2629
    @guidoserrano2629 3 года назад

    I’m so thankful for your videos.
    Would it be possible to have a video on how to manage gpg with yubikeys? I followed so many guides online. And I managed to upload the 3 subkeys to both of my yubikeys but I don’t know how to make it work with SSH.
    Also what do you think is more secure, this approach or the one you showed on this video?

  • @AnzanHoshinRoshi
    @AnzanHoshinRoshi 3 года назад

    Thank you, Jay.

  • @CraigOlson
    @CraigOlson Год назад

    great vid! thanks a lot

  • @thedoubleop
    @thedoubleop 3 года назад

    Awesome video.

  • @yamitvargas8065
    @yamitvargas8065 3 года назад

    Hi, thanks so much for your video(s), always great content.
    About your book, I have two questions:
    1. is the book for persons with little knowledge in Linux, and
    2. Can you purchase the book in Europ?

  • @LeszekT-IT
    @LeszekT-IT 3 года назад

    Hi,
    With such setup which security function of the key is being used?

  • @sumitxshah
    @sumitxshah 3 года назад

    hi jay , thank fro this video , can we configure RSA token also as 2FA for ubuntu personal laptops?

  • @Glatze603
    @Glatze603 2 года назад +3

    Thanks Jay for this nice security-video - one more step to feel like Fort Knox :-) It would be helpful if you could explan how to install a second backup-yubikey, too. Personally, I feel better when I still have a spare key - and I bought 2 especially for backup reason.

    • @stevenwaters134
      @stevenwaters134 2 года назад +1

      Local login for a single user with two keys can be done. It has some similarities to what is done to use two keys for ssh. Guido Serrano's replies to Sean Murray below describe what to do for ssh, but not logins to a local machine. For local logins we need to modify ~/.config/Yubico/u2f_keys. This file can have only one line, so we need to append the outputs from pamu2fcfg for each key. Include your username only once at the beginning of the line. The key information is in four fields separated by commas. Be sure there is a colon between the username and the first key and one between keys.
      username:,,,:,,,

    • @sethm7761
      @sethm7761 2 года назад +1

      I tested this, you simply need to remove your primary yubikey and insert your backup and repeat the pamu2fcfg command but appending to the u2f_keys file as opposed to overwriting.
      Specifically:
      (1) Swap yubikeys
      (2) pamu2fcfg >> ~/.config/Yubico/u2f_keys
      That should be it

  • @TheLastBabyBoomer
    @TheLastBabyBoomer 3 года назад

    Awesome!!! Thanks.

  • @JamesClifford1
    @JamesClifford1 8 месяцев назад

    Thank You!

  • @skim3tokes
    @skim3tokes 2 года назад

    hi @LearnLinuxTv I tried the pamu2fcfg >.. command but it says no u2f device detected. Is there anything I need to do prior to this step?

  • @oleholgerson3416
    @oleholgerson3416 3 года назад +1

    Is it also possible to protect the ssh keys with a yubikey?

  • @BeeJay91
    @BeeJay91 3 года назад

    Thanks dude

  • @oleholgerson3416
    @oleholgerson3416 3 года назад

    great, thank you!

  • @sublevel123
    @sublevel123 3 года назад

    What i would like is, a usb key i can put in a pc which give me a replica of my main pc, i have 5 diff pc at home and want 1 machine host and all the rest slave, either on harddrive (laptop 3) or small factor no hd, usb key only, sata problem... local os but with my home and / all sync up . running mint 20, any idea

  • @user-lk9wy7hi1d
    @user-lk9wy7hi1d 2 года назад

    Is it possible to require a yubikey for logging into your phone? I'd like to have this for initial login

  • @aakashudassi4258
    @aakashudassi4258 2 года назад

    Is this method better or generating sk keys and passing to server better ?

  • @troyfred2562
    @troyfred2562 2 года назад

    Really helpful! Can you make another one where you tie that yubikey to an IDM or FreeIPA user?

  • @skippy284
    @skippy284 Год назад

    I know this is an older video but I was need to know what line I can change in the gdm-password and the sudo files that will allow me to just use my yubikey and not have an option for a password I have already set it to use the yubikey by it's self but I want to remove the password all together on my deskop version of ubuntu22.04 thanks

  • @necromancerking2238
    @necromancerking2238 2 года назад

    im using zorin but i custom installed KDE as my DE do i still use gmd-password or something else

  • @fredzibulski3111
    @fredzibulski3111 Год назад

    love your videos and got this to work for te login on ubuntu. Wanted to know what the process is to add a second backup Yubikey for the login

  • @intermarer9145
    @intermarer9145 Месяц назад

    15:23 how is a USB stick able to insert text in a text editor??? Did you load up some program first?

  • @Dan-hh7ve
    @Dan-hh7ve 2 года назад

    useful stuff, thanks

    • @Dan-hh7ve
      @Dan-hh7ve 2 года назад

      would be very interesting how to setup self-hosted Yubico OTP validation server and see how it works instead of Yubico cloud service. thanks

  • @bilalabudan9645
    @bilalabudan9645 2 года назад

    is that possible if you login like this :
    plugin yubikey on your PC -> ssh to server A (with yubikey login) -> ssh to another server (with yubikey login) that plug-in on your PC
    so there 2 step login (local PC -> remote server A -> remote server B)
    all ssh user the yubikey on your PC
    is that possible?

  • @chapas5400
    @chapas5400 Год назад

    I'm at a point where I don't really know what to do next, it does not ask to touch the yubikey. It has worked on other systems. Any hints for me?

  • @Eni11-i6t
    @Eni11-i6t Месяц назад +1

    It for some reason does not work at all when the Yubikey already has a pin. It associates just fine with the device but if I add it to the Sudo, it just will keep asking me for password and refuse both the pin or touching it, and I am then locked out of the machine

  • @byronbrimstone5163
    @byronbrimstone5163 6 месяцев назад

    Is it safe to do this with an encrypted OS install? And what about required minimum BIOS settings?

  • @sethmartin6844
    @sethmartin6844 2 года назад +2

    Good video -- if I want to associate multiple yubikeys to my computer for backup purposes... do I just append to the end of the file or does it need to be comma separated ?

    • @LuisCaneSec
      @LuisCaneSec 2 года назад +1

      I figured out that you separate with a colon. in your authfile you would have ::
      For the desktop command pamu2fcfg > ~/.config/Yubico/u2f_keys, you would just use >> instead of > to append a second key.

    • @Heatsreef
      @Heatsreef 2 года назад

      @@LuisCaneSec Thanks man really helped me out here

  • @spinkey4842
    @spinkey4842 3 года назад

    is it possible to just turn an normal usb drive in to a "yubikey"?

  • @dirk-jan768
    @dirk-jan768 Год назад

    Thanks to you I configured it correctly, but Linux starts without my permission when the key is not connected. Is that how it is supposed to be? Thanks anyway!

  • @mojar2680
    @mojar2680 2 года назад

    Ok, I've set it all up and it works great but now I'm wondering whether I can connect to ssh with only my yubikey, no ssh, no password. just a touch of the yubikey.

  • @BEDavisBrown
    @BEDavisBrown 2 года назад +3

    If you disabled password logins on the linode server why then after setting up the yubikey it uses the yubikey and a password?

  • @jp62200
    @jp62200 7 месяцев назад +1

    This video is quite old. It is much simpler to use ssh now that fido2 is integrated in openssh, basically you just need to do a ssh-keygen -t ed25519 -O resident . When using the key on new pc, do a ssh-keygen -K to copy the pub key on the host.

  • @michealfinane4448
    @michealfinane4448 3 года назад +1

    Hi Jay with regards to a Linux workstation how to you manage more than on key per user?
    I have been using Yubikey keys for a while now and love them but mostly for full disk encryption with one time password and the rest on online accounts, I tried to add both of my keys as you need a backup and PopOs only records the list key I registered, Is there a way to add as many keys as you like?

    • @Runenaldo
      @Runenaldo 3 года назад

      Would also like to know.

    • @creonte38
      @creonte38 3 года назад +2

      Here you have the answer for your question, looking for this sentence: "You may add multiple yubikeys to a user by separating the token IDs with a colon. For example, here we will allow the "root" yubikey to also authenticate "harry" " in this page: fedoraproject.org/wiki/Using_Yubikeys_with_Fedora

    • @michealfinane4448
      @michealfinane4448 3 года назад +1

      @@creonte38 Thank you Ayr very helpful :)

    • @creonte38
      @creonte38 3 года назад +1

      @@michealfinane4448 regards!

  • @demus8757
    @demus8757 8 месяцев назад

    Great video, as always. One question though: what happens when an attacker with physical access to the laptop uses his own Yubikey? Is there a code inside the key which is also in the computer when setting it up, or are they all identical?

    • @XXX-XX-X-X
      @XXX-XX-X-X 6 месяцев назад

      All keys are not identical. Yubikey has great docs you should look into to know if it's right for you.

  • @creonte38
    @creonte38 3 года назад

    Amazing video. Unfortunately I have 2 Yubikey standard not supported anymore. If you know how to flash the firmware to transform these in something valid to use I appreciate. I have one Yubikey neo and one Thetis too.

    • @anon1div0
      @anon1div0 3 года назад

      YubiKey firmware can not be flashed or updated for security reasons.

  • @Nirkan88
    @Nirkan88 Год назад

    Dear all, Is there an official documentation for Securing remote authentication at 11:57 onwards.

  • @MrSojek
    @MrSojek 2 года назад

    Will I need Yubikey even if I auto login to my account?

  • @DanielFridlandd
    @DanielFridlandd 3 года назад

    Great video. Do you know if something like this works in Arch and Fedora as well?

    • @SamuelRaynor79
      @SamuelRaynor79 3 года назад +1

      Fedora and Arch both have the packages in their repos. Just search for 'yubikey fedora' or 'yubikey arch'

    • @DanielFridlandd
      @DanielFridlandd 3 года назад

      @@SamuelRaynor79 Thanks 👍 I will do that

  • @Seanofthemurray
    @Seanofthemurray 3 года назад

    How do you set up multiple yubikeys with regard to the /etc/pam.d/sshd file?

    • @guidoserrano2629
      @guidoserrano2629 3 года назад

      I'm also curious. I've tried adding both to the sshd file as well, but is not working. Did you figure it out?

    • @guidoserrano2629
      @guidoserrano2629 3 года назад +1

      I just managed to do it. You need to add the 12 first digits of the 1st Yubikey followed by “:” and the 12 digits of the second Yubikey. All in the same line.
      Everything else as it shows on this guide. Hope it helps.

  • @AdrianHiggins83
    @AdrianHiggins83 3 года назад

    add a second key to ~/.config/Yubico/u2f_keys ?

  • @wenmoon9466
    @wenmoon9466 Год назад +1

    Isn't it easier to do "ssh-keygen -t ed25519-sk" ? How is this method better?

    • @jp62200
      @jp62200 7 месяцев назад

      Yes, but the video was done before the integration of fido2 directly in openssh

  • @js_programmer8423
    @js_programmer8423 2 года назад

    Where do you find that 12 digit key ?

    • @onlo3848
      @onlo3848 2 года назад

      I'm also not sure about this. Though ...I have the "Security Key" Series. I'm not sure if my Yubikey does this ...it seems like an OTP thing

  • @evanopilismithjones214
    @evanopilismithjones214 Год назад +1

    At enabling TTY i am kicked out of my computer. And though I am given the chance to put my password as I normally do. It keeps thinking until it stops. Then I remembered I put the TTY as specified in the video. Ctrl + alt + f2 gives me terminal login. I put my username and password and it doesn't work.

    • @jackporter6820
      @jackporter6820 Год назад

      Same here Ubuntu 22.04

    • @evanopilismithjones214
      @evanopilismithjones214 Год назад

      @@jackporter6820 I solved it. The problem was that the I had my data in Home encrypted. There were my Yubuco keys found, so it couldn't work cuz of the info to allow through was encrypted.
      Solution?
      Go to Root and modify the files i modified in this video.
      If you are not using dual boot better. Backup and encrypt your hard drive with LUSK2.
      If using dual boot, you are fucked. Sooooo, get a new laptop or you wont be able to use encrypted home and keys

  • @js_programmer8423
    @js_programmer8423 2 года назад

    How to add 2 Yubi keys ?

  • @Matthewss87
    @Matthewss87 3 года назад +1

    This is a great idea for security but what happens if you lose your key?

    • @Runenaldo
      @Runenaldo 3 года назад +4

      Always have a backup Yubikey.

    • @michealfinane4448
      @michealfinane4448 3 года назад

      @@Runenaldo How do you add the backup key I tried it only works with the last one added?

    • @Runenaldo
      @Runenaldo 3 года назад

      @@michealfinane4448 Don't know unfortunately, wish it would be shown in this video as it should be standard practice IMO.

    • @michealfinane4448
      @michealfinane4448 3 года назад

      @@Runenaldo I checked Yubikey site as well and there is no mention of it other that a warning not to loose your key!

    • @Runenaldo
      @Runenaldo 3 года назад

      @@michealfinane4448 Strange.

  • @danielstellmon5330
    @danielstellmon5330 3 года назад +3

    with an SSH log in can I use a Yubi key and a ssh certificate (rather than Yubi and password)? I really just want to skip the password.

    • @rustho
      @rustho 3 года назад +3

      +1 .. really curious about that solution. (ssh into account with key then press yubi instead of password)

    • @mahnazha
      @mahnazha 3 года назад

      Did you find a solution for that? I want to know as well!

  • @aidemalo
    @aidemalo 3 года назад +1

    Yubi Yubi

  • @GuillermoPradoObando
    @GuillermoPradoObando 3 года назад

    Do you have any different from this video? Looks more cool and smoth. Thanks for the great content

  • @chiragsukhala
    @chiragsukhala 3 года назад +1

    Secrets not Secret anymore @18:38

  • @arnoldwolfstein
    @arnoldwolfstein 2 года назад +1

    yubikey should make better user friendly processs. so hard and intimidating

    • @arnoldwolfstein
      @arnoldwolfstein 2 года назад

      and i am a linux admin. +im using arch btw

  • @jetblackstar
    @jetblackstar Год назад

    Huh, watched the whole video for using against remove SSH sessions, and you didn't cover SSH keys + Yubikey. Oh well.

  • @diuran1919
    @diuran1919 3 года назад +3

    I like Linux but See how this need to be configure I say BIG NO. Yubikey and linux foundation or whatever, they need cooperate to create easy way to make this much easy to work in Linux OS.

  • @user-ir1ix8up8j
    @user-ir1ix8up8j 8 месяцев назад

    this process will fail and lock you out of your own system, you will have to use a live version of your OS to go into your file system and remove the offending lines in your pam.d file to rescue your system, do not trust yubikey for login as it will fail on linux and windows

  • @user-ir1ix8up8j
    @user-ir1ix8up8j 8 месяцев назад

    also there is no way to create a backup of the key, so your basically screwed all the way around with these useless devices

    • @jp62200
      @jp62200 7 месяцев назад

      You just need to register 2 devices. When you loose one, you register a new one with backup one...

  • @geirha75
    @geirha75 3 года назад

    I'm running Lubuntu. Where is the desktopmanager file located in order to edit for youbikey login?

    • @jawuku3885
      @jawuku3885 3 года назад

      I think it might be /etc/pam.d/sddm
      if you are using Lubuntu with the LXQT desktop. Same goes for Kubuntu or KDE Neon.

    • @user-eo6gp7zy2s
      @user-eo6gp7zy2s 3 года назад

      ​@@jawuku3885 Thank you! You helped me a lot! I have Kubuntu 20.04 and I was trying to find the solution endlessly!