Quote**To enable SSH on OPNsense when you've lost WebUI access, use the built-in console menu (available via physical VGA/keyboard, serial, or VM console).** This works because SSH configuration lives in `/conf/config.xml` (the central config file), and the console gives you shell access to edit it directly. No internet or WebUI is required.
### Step-by-Step Instructions
1. **Access the console**
- Connect a monitor + keyboard (VGA) or serial cable.
- In a VM (e.g., Proxmox/ESXi), open the VM console.
- Power on or reboot if needed. Log in as **root** with your root password (default is usually `opnsense` on fresh installs, or whatever you set).
2. **Enter the OPNsense menu**
You'll see a numbered list (something like):
```
1) Assign Interfaces
2) Set interface(s) IP address
...
8) Shell
5) Reboot system
...
```
**Choose `8) Shell`** (this drops you to a FreeBSD root shell).
3. **(Optional but recommended) Verify current state**
```
ssh localhost
```
or
```
ps aux | grep sshd
```
If nothing is listening on port 22, SSH is disabled.
4. **Edit the config to enable SSH**
```
vi /conf/config.xml
```
(vi is built-in; press `i` to insert/edit, Esc to exit insert mode, then `:wq` to save & quit. If you prefer nano: `pkg install nano` first.)
- Press `/` then type `system` and Enter to jump to the `<system>` section.
- Inside the `<system>` ... `</system>` block, **add or edit** the `<ssh>` subsection so it looks like this (place it near the end of the `<system>` block, before `</system>`):
```xml
<ssh>
<enabled>1</enabled>
<port>22</port>
<permitrootlogin>1</permitrootlogin> <!-- allows root login (recommended for recovery) -->
<passwordauth>1</passwordauth> <!-- allows password login -->
<!-- Optional: restrict to LAN only -->
<!-- <interfaces>lan</interfaces> -->
</ssh>
```
- If a `<ssh>` block already exists, just change `<enabled>0</enabled>` (or missing) to `1` and add the other lines as needed.
- Values like `1` (or sometimes `enabled`) both work; `1` is standard.
5. **Apply the changes** (no reboot needed in most cases)
```
/usr/local/etc/rc.sshd restart
```
or
```
configctl sshd restart
```
(If neither works: `pkill sshd; /usr/local/sbin/sshd`)
You can also just reboot from the menu (exit shell with `exit`, then choose `5) Reboot system`).
6. **Test SSH**
From another machine on the same LAN:
```
ssh root@YOUR-OPNSENSE-LAN-IP
```
(e.g., `ssh root@192.168.1.1`). It should connect and drop you straight into the OPNsense menu.
### Extra Tips & Common Fixes
- **If you also lost WebUI access** (same root cause):
In the same `/conf/config.xml` edit, look for the `<webgui>` section and make sure it has `<enabled>1</enabled>` and no overly restrictive `<listenaddr>` or `<interfaces>`.
Or simpler: from the console menu, choose **2) Set interface(s) IP address** → it often offers to "restore web GUI defaults" (switches back to HTTPS on all interfaces).
- **Firewall rules**:
Once SSH is enabled in config, the built-in **anti-lockout rule** (on LAN) automatically allows port 22 to the firewall itself. You don't need to add a manual rule for LAN access.
- **Security notes**
- Only enable root login temporarily if needed.
- For production, create an admin user in the admins/wheel group, add your SSH key under **System > Access > Users**, then disable password/root login later (when WebUI is back).
- Restrict listen interfaces to LAN only in the `<ssh>` block if desired.
- **Backup first** (good practice):
Before editing:
```
cp /conf/config.xml /conf/config.xml.bak
```
This method is the standard recovery path documented across OPNsense forums, GitHub issues, and troubleshooting guides. Once SSH is up, you can fix the original WebUI issue from the shell or re-enable the GUI properly.
If you run into any error (e.g., XML syntax), paste the exact error here and I can help debug the config snippet. Good luck!
Quote from: scorpid on February 25, 2026, 02:33:59 PMкоторый сам поднимает интерфейс TUN.это не совсем правда. Интерфейс tun вкорячивается в систему скриптом прямо в конфиг opnsense.
Quote from: nero355 on February 25, 2026, 07:01:03 PMThis document explains all the options and seems to match your experience : https://www.networkmanager.dev/docs/api/latest/settings-ipv6.html