How to Enable and Secure SSH on pfSense

SSH into pfSense gives you the console menu and a shell from your own terminal, which is handy for updates, checking logs or fixing things when the web GUI is misbehaving. SSH is off by default on pfSense, so you have to turn it on. This guide shows how to enable it, add an SSH key, and lock it down so it doesn’t become a way in for anyone else.
I run pfSense on my own network. The steps below follow Netgate’s current documentation for pfSense CE 2.9.0 and pfSense Plus 26.07.
What you need
- pfSense CE 2.9.0 or pfSense Plus 26.x (older releases use the same menus, but see “Keep pfSense current” below).
- Admin access to the pfSense web GUI, or the physical console (VGA or serial).
- A computer on the LAN with an SSH client. Linux, macOS and Windows 10 or 11 all include OpenSSH.
Step 1: Enable SSH access
- In the web GUI, go to System > Advanced and open the Admin Access tab.
- Under Secure Shell, tick Enable Secure Shell.
- Set SSHd Key Only to Public Key Only. This only allows key-based logins, which is what Netgate recommends.
- Optional: enter a port in SSH Port. Leave it blank to use port 22.
- Click Save.
Screenshot:

The SSHd Key Only dropdown has three choices:
- Password or Public Key (the default): a valid password or an authorised key is enough.
- Public Key Only: an authorised key is required. Passwords alone won’t work.
- Require Both Password and Public Key: the user needs both, which is the strictest option.
If you pick one of the key options, add a key (Step 2) before you log out of the GUI, or you will have no way to log in over SSH.
No web GUI? Use the console
If you can’t reach the GUI, connect to the console (VGA or serial) and choose option 14 from the console menu to enable or disable SSH. To change the port or the key options afterwards, use the GUI as above.
Step 2: Create an SSH key
On your own computer, create a key pair. Ed25519 keys are short, fast and supported by current OpenSSH:
ssh-keygen -t ed25519 -C "pfsense-admin" -f ~/.ssh/pfsense_ed25519
Set a passphrase when asked. You’ll get two files:
~/.ssh/pfsense_ed25519is your private key. Keep it on your machine and never share it.~/.ssh/pfsense_ed25519.pubis the public key. This is the one you paste into pfSense.
If you need RSA for an older client, use at least 3072 bits rather than the old 2048 example:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/pfsense_rsa
For more on key pairs, see my guide to passwordless SSH access using key pairs.
Step 3: Add the public key to your pfSense user
- Go to System > User Manager.
- Edit the user that needs SSH access (for example
admin). - Paste the contents of your
.pubfile into Authorized SSH Keys. - Click Save.
A few things from the Netgate docs worth knowing:
- The
adminandrootusers share keys, so a key onadminalso works forroot. - Manage keys in the User Manager only. Don’t edit key files from the shell, because pfSense rewrites them from its own config.
Step 4: Connect
From your computer on the LAN:
ssh -i ~/.ssh/pfsense_ed25519 admin@192.168.1.1
Replace 192.168.1.1 with your pfSense LAN address, and add -p 2222 (or whatever you chose) if you changed the port. Logging in as admin or root shows the familiar pfSense console menu; pick option 8 for a shell. The pfSense shell commands cheat sheet covers what you can do from there.
To save typing, add a host entry to ~/.ssh/config:
Host pfsense
HostName 192.168.1.1
User admin
Port 22
IdentityFile ~/.ssh/pfsense_ed25519
Then just run ssh pfsense.
Step 5: Give other users SSH access (optional)
By default only admin and root can log in over SSH. To let another user in:
- In System > User Manager, edit the user and add their public key.
- Under Effective Privileges, add User - System - Shell account access.
- Save.
These users don’t get full root privileges, so they don’t see the console menu. If they need to run admin commands, Netgate suggests the Sudo package.
Keeping SSH safe
- Keep it on the LAN. With the default rules, SSH is only reachable from the LAN. That’s the safest place for it. If you need remote access, use a VPN (WireGuard, OpenVPN or Tailscale) and SSH over that, rather than opening port 22 on the WAN.
- If you must allow WAN access, use Public Key Only and restrict the firewall rule to the source addresses you trust. Netgate notes that changing the port on its own is not enough protection.
- Leave Login Protection on. pfSense uses sshguard to block addresses after repeated failed logins to SSH and the web GUI. Its settings are under System > Advanced > Admin Access > Login Protection. Add your own management addresses to the pass list so you don’t lock yourself out.
- Don’t expose the web GUI to the internet. Netgate’s advisory pfSense-SA-25_09.sshguard found that Login Protection could be bypassed for some web GUI usernames on pfSense Plus before 25.11 and CE 2.8.1 and earlier. SSH logins were not affected, but the fix is another reason to stay current.
Keep pfSense current
As of November 2026 the current releases are pfSense CE 2.9.0 and pfSense Plus 26.07. CE 2.9.0 adds post-quantum key exchange algorithms to SSH, includes a WireGuard security fix (CVE-2026-58085) and fixes the sshguard issue above. Netgate has also published a run of web GUI advisories through 2026, so check the security advisories page and update when a fix lands.
You can update from the GUI, or over your new SSH connection: see how to update pfSense from the command line. Before you upgrade, read the release notes, including the hardware errata section: in the 2.9.0 release thread, some users on Celeron J series hardware reported kernel panics and pointed to the workaround listed there.
Troubleshooting
- “Permission denied (publickey)”: SSHd Key Only is set to a key option but the key isn’t on that user, or you are pointing
ssh -iat the wrong private key. Check the key in the User Manager and runssh -vto see which keys your client offers. - “Connection refused” or a timeout: SSH isn’t enabled, you’re using the wrong port, or you are connecting from a network without a firewall rule that allows it (by default only the LAN can reach it).
- Suddenly blocked after a few attempts: Login Protection (sshguard) has blocked your address. Wait for the block to expire or remove it from the console, then add your address to the pass list.
- A non-admin user logs in but gets no menu: that’s expected. Only
adminandrootsee the console menu.
Sources
- Netgate docs: Granting Users Access to SSH
- Netgate docs: pfSense releases
- Netgate forum: Now Available, pfSense CE 2.9.0 Release
- Netgate security advisories
- Netgate advisory pfSense-SA-25_09.sshguard
- OpenBSD manual: ssh-keygen
Updated 17 November 2026: new title, checked against pfSense CE 2.9.0 and Plus 26.07, Ed25519 keys, console method, extra users, hardening and troubleshooting.