Guide

Passkeys, Two-Factor Codes and Recovery: What to Use

Last updated: 30 November 2026

A strong password alone does not protect you if someone steals it or tricks you into typing it on a fake page. This guide compares the common second factors and shows how to set them up so you do not lock yourself out.

Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works

Start with passwords that are never reused

When one website leaks its password database, attackers try the same email and password elsewhere. A password manager solves this by creating a different long random password for every account. You then only need to remember one strong master password.

A useful side effect: many password managers only offer to fill a password on the site it was saved for. If it suddenly stays silent on a familiar-looking login page, check the address bar before you type anything by hand.

The second factors, compared

MethodStops a fake login page?Main weakness
SMS or voice codeNoPhone number takeover, intercepted or relayed codes
Authenticator app code (TOTP)NoA fake page can pass your code on in real time
Push approvalUsually notApproving a prompt you did not start
Passkey or FIDO2 security keyYesYou need a plan for lost devices

The US standards body NIST states that codes you type in by hand are not phishing resistant, because nothing ties the code to the real site. It also treats codes sent over the phone network as a restricted method.

Any second factor is far better than none. If SMS is the only option, turn it on. If a better one exists, use it, and then check whether SMS is still enabled as a fallback. An attacker picks the weakest way in, not the one you prefer.

Passkeys and security keys

A passkey is a pair of cryptographic keys. The website stores the public half; the private half stays with your device or password manager. You unlock it with your fingerprint, face or device PIN. The passkey is bound to the real site's domain, so a lookalike domain cannot use it.

OpenSSH (version 8.2 and newer) also supports security keys for server logins:

ssh-keygen -t ed25519-sk

Both the client and the server must support this key type, and some older hardware keys only work with ecdsa-sk. Add the new public key and test it in a second terminal before you remove any old way of logging in, or you can lock yourself out.

Recovery codes: the part people skip

When you enable two-factor login, many services show a list of recovery codes. These let you in if your phone or key is gone. Treat each one like a password. On many services, including GitHub, each code works once, and generating a new set cancels the old one.

  1. Save the codes at the moment you are shown them.
  2. Keep a printed copy somewhere safe at home, or in an encrypted file that does not depend on the device that could be lost.
  3. Avoid keeping the only copy inside the account it unlocks, such as codes for your email stored in that email.
  4. Think about circular traps: if the codes for your password manager are only inside your password manager, they cannot help you.
  5. After using a code, check how many remain and make a fresh set if needed.

Once or twice a year, do a mental fire drill: imagine your phone is gone right now. Which accounts could you still open, and with what? Fix the gaps while you still have access.

If you use authenticator app codes, check whether the app can back up or transfer them, and move them before you wipe or sell an old phone.

Reducing SIM-swap risk

In a SIM swap, someone persuades or tricks a mobile carrier into moving your number to their SIM. In a port-out scam, the number is moved to another carrier. Either way your texts and calls go to the attacker.

A SIM card PIN is worth setting too, but it solves a different problem: it protects a physical SIM that is stolen. It does not stop a carrier from issuing a new one.

A sensible order of work

  1. Email account: passkey or security key, recovery codes saved, SMS removed if possible.
  2. Password manager: the same.
  3. Banking, domain registrar and hosting accounts.
  4. Social and shopping accounts.

For a server, protect both the control account at the provider and the server login itself; see SSH keys on a VPS and Fail2ban. At PhantomVPS you sign up with an email address and no phone verification, so the security of that mailbox matters and is worth doing first.

Questions and answers

Is SMS two-factor worse than no two-factor?
No. It still blocks someone who only has your password. The problem is mainly when a phone number can also reset the password, so check the recovery settings.

Should I keep authenticator codes in my password manager?
It is convenient and still helps if a website leaks your password. It puts both factors in one place, so for your most important accounts a separate device or security key is safer.

What happens if I lose my phone with my passkeys?
Synced passkeys can usually be restored through the account that syncs them. For device-bound ones you need a second registered key, recovery codes, or the service's recovery process.

Does a passkey replace my password?
On some services it does; on others the password stays active. If it stays, keep it long and unique, because it is still a way into the account.

Related guides

Ready to try it? Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works