How to use pin login

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
robertzou
Level 1
Level 1
Posts: 1
Joined: Tue Mar 28, 2023 1:20 pm

How to use pin login

Post by robertzou »

NOTE: This method is only for login. If you want to be able to sudo with a pin (HIGHLY NOT RECOMMENDED), change the password to a pin.

Since a lot of people moved to Linux Mint from Windows, here is a way to login with a pin but still use password as sudo.

You will need the libpam-pwdfile module.
  • First, open up a terminal and install the libpam-pwdfile module:

    Code: Select all

    sudo apt install -y libpam-pwdfile
    
  • Next, install whois:

    Code: Select all

    sudo apt install whois
  • Now login as root from terminal

    Code: Select all

    sudo -i
  • Backup your lightdm login manager file:

    Code: Select all

    cp /etc/pam.d/lightdm /etc/pam.d/lighdm_ORIGINAL
    
  • Run the pin creation script:

    Code: Select all

    echo "YOURNAME:$(mkpasswd -5)" > /etc/custompinfile
    (replace YOURNAME with your username)
  • Open the lightdm login manager file:

    Code: Select all

    sudo gedit /etc/pam.d/lightdm
  • Add this line to the top:

    Code: Select all

    #%PAM-1.0
    auth    sufficient  pam_pwdfile.so pwdfile=/etc/custompinfile
    
  • Make the custompasswordfile read only:

    Code: Select all

    chmod 400 /etc/custompinfile
Optional, change the seahorse keys and passwords unlocking password to your pin. If you don't you will get a prompt similar to this:
Image

Open up passwords and keys (seahorse), right click on login and click on change password, enter your old password and enter the new pin. If it doesn't work, you can leave it blank if the computer is only accessible to you.

Restart computer and login with your pin

Credits to: https://askubuntu.com/a/1304887, adapted for Linux Mint
Last edited by SMG on Tue Mar 28, 2023 3:17 pm, edited 1 time in total.
Reason: Moved from Chat about Linux to Tutorials.
unmedius
Level 1
Level 1
Posts: 1
Joined: Sun May 14, 2023 9:44 pm

Re: How to use pin login

Post by unmedius »

That worked like a charm, thank you!

Now I'd like to use that PIN that I created with lock screen (cinnamon-screensaver, i believe)
I've tried to backup "/etc/pam.d/cinnamon-screensaver", entered "auth sufficient pam_pwdfile.so pwdfile=/etc/custompinfile" there, then saved, rebooted
That didn't work

Can you help me out?
Andy_Mint
Level 1
Level 1
Posts: 1
Joined: Thu Aug 10, 2023 4:46 am

Re: How to use pin login

Post by Andy_Mint »

Hi,

I have a problem with:
Open the lightdm login manager

when I type in the command - sudo gedit /etc/pam.d/lightdm - I get:

sudo: gedit: command not found

what shall I do?!

Thanks
RIH
Level 9
Level 9
Posts: 2834
Joined: Sat Aug 22, 2015 3:47 am

Re: How to use pin login

Post by RIH »

I believe that currently Mint used xed rather than gedit.

If gedit is a must then it can be downloaded from the software manager - or

Code: Select all

sudo apt install gedit
in a terminal..
Image
barydos
Level 1
Level 1
Posts: 8
Joined: Thu Sep 28, 2023 9:32 pm

Re: How to use pin login

Post by barydos »

This worked perfectly!
I can login using either my password OR the pin.
And meanwhile sudo is still authorised via password only.

Thank you for this tutorial!

EDIT: similar to the other user, I am struggling to apply this to the lock screen (suspending).
Post Reply

Return to “Tutorials”