Why every other guide fails
If you've been Googling "ubuntu set 4 digit pin" or "ubuntu short password," you've probably found the same advice recycled across a dozen forums: edit pwquality.conf, lower the minimum length, then use passwd to set your new PIN. Sounds simple. Doesn't work.
The problem is that Ubuntu doesn't have one password enforcement system — it has several, and they don't fully talk to each other. You can relax the rules in one place and a different layer quietly overrides you. The two biggest culprits are a setting called obscure and another called enforce_for_root. These sit inside a file called common-password and they will reject your short PIN even when you're an administrator, even after you've supposedly turned everything off.
Most guides miss both of them. That's why you keep getting "BAD PASSWORD: The password fails the dictionary check" no matter what you do.
passwd at all. Use chpasswd instead — it writes the password hash directly to the system and completely bypasses the rule-checker. That's the one change that makes everything actually work.
What the script does (in plain English)
The script handles the whole process in one shot. Here's what it does under the hood — no terminal experience required to understand it:
- Backs up three system files before touching anything, and prints an exact restore command when it finishes — so you can undo everything with one line if needed.
- Lowers the minimum password length to 4 digits across all the places Ubuntu checks it, not just one.
- Removes the obscure and enforce_for_root settings — the two flags that block short passwords even as an admin.
- Sets your PIN using chpasswd, which skips the rule-checker entirely rather than fighting through it.
- Runs a safety check on the PAM file — if something looks broken after the edit, it auto-restores the original so you can't get locked out.
It asks you to confirm before doing anything, lets you pick which user account gets the PIN, and makes you type it twice to confirm. The whole thing takes about 60 seconds.
Is a 4-digit PIN safe on Ubuntu?
Short answer: it's weaker than a normal password, and you should know that going in. A 4-digit PIN has only 10,000 possible combinations. Someone with physical access to your computer could try to brute-force it.
Windows also uses 4-digit PINs for login — but Windows ties the PIN to your specific device using a hardware security chip called TPM. That means the PIN is useless on any other machine. This script does not do that. Your PIN is essentially just a short password, not a hardware-bound credential.
For a personal home computer where convenience matters more than high security, it's a reasonable tradeoff. For a work laptop, a server, or any machine with sensitive data, stick with a strong password.
Which Ubuntu versions does it work on?
The script has been tested and confirmed working on Ubuntu 22.04 LTS and Ubuntu 24.04 LTS. It should also work on Ubuntu 20.04. Linux Mint, Pop!_OS, Kubuntu, and other Ubuntu-based distros will likely work too since they share the same underlying password system — but they haven't been formally tested.
If you're on Fedora, Arch, Manjaro, or another non-Debian-based distro, this script is not for you. Those systems use a different password management stack and the script won't behave correctly.
Not sure what version you're running? Open a terminal and type lsb_release -d — it'll tell you exactly.
One thing to do before you reboot
This is the most important thing in this entire article: test your PIN before you reboot. Once the script finishes, lock your screen with Super + L (the Windows key plus L) and log back in with your new 4-digit PIN. If it works, you're done. If it doesn't, your terminal window is still open and you can run the restore command the script printed — no harm done.
If you skip this step and reboot into a broken login, recovery is possible but it means booting from a USB drive. Just test first. It takes 10 seconds.
How to download and run it
The script is free and hosted on GitHub. You don't need a GitHub account to download it.
- Go to the ubuntu-pin4-tool repository
- Click install_pin4_ubuntu.sh, then click the download button
- Save it to your Desktop or Downloads folder
- Open your Files app, navigate to the file, right-click on empty space in that folder, and choose Open Terminal Here
- Type
sudo bash install_pin4_ubuntu.shand press Enter - Follow the prompts — it walks you through everything
The README on the GitHub page has the full step-by-step instructions including what to do if something goes wrong. It's written for people who aren't Linux experts — no jargon, no assumptions.