Home › SSH

channel 0: open failed: administratively prohibited: open failed (SSH) — how to fix

channel 2: open failed: administratively prohibited: open failed
channel 3: open failed: connect failed: Connection refused

Quick fix: On the server, allow forwarding in /etc/ssh/sshd_config (AllowTcpForwarding yes, and PermitOpen any if restricted), check Match blocks and restrict/permitopen options in authorized_keys, then sudo sshd -t && sudo systemctl reload ssh (or sshd). Also check the target host:port in your -L/-J is correct from the server's point of view.

What it means

Your SSH login worked, but when the client asked the server to open an extra channel (for -L, -R, -D, -W, ProxyJump, or agent/X11 forwarding), sshd said no. administratively prohibited is the reason code for "policy forbids this". The connection itself stays open; only the tunnel fails, often showing up when you use the forwarded port.

A related message, open failed: connect failed: Connection refused (or Name or service not known), means forwarding is allowed but the server could not reach the target you named.

Cause 1: TCP forwarding disabled in sshd_config

Check the effective settings on the server:

sudo sshd -T | grep -Ei 'allowtcpforwarding|permitopen|allowagentforwarding|x11forwarding|disableforwarding'

If allowtcpforwarding no, permitopen none or disableforwarding yes appears, edit /etc/ssh/sshd_config (or a file in /etc/ssh/sshd_config.d/):

AllowTcpForwarding yes
PermitOpen any

AllowTcpForwarding local allows only -L/-D/-W style forwards, remote only -R. Look for Match User/Match Group blocks further down the file that override these values for your user.

Validate and reload:

sudo sshd -t
sudo systemctl reload ssh      # Debian/Ubuntu
sudo systemctl reload sshd     # RHEL/Fedora/Arch

Cause 2: restrictions in authorized_keys

A key can be limited per-line in ~/.ssh/authorized_keys:

restrict,command="/usr/bin/backup" ssh-ed25519 AAAA... backup@host
no-port-forwarding ssh-ed25519 AAAA... me@laptop
permitopen="db.internal:5432" ssh-ed25519 AAAA... me@laptop

restrict and no-port-forwarding block all forwarding; permitopen only allows the listed destinations. Remove the option or add the destination you need (requires access to the server account).

Cause 3: ProxyJump through a locked-down bastion

ssh -J bastion target uses a forwarding channel on the bastion. If the bastion has AllowTcpForwarding no, you get this error right after authenticating to the bastion. The bastion admin must allow forwarding (at least local), possibly with PermitOpen limited to the internal hosts.

Cause 4: wrong target in the forward

In ssh -L 8080:localhost:80 server, localhost is resolved on the server. If the service listens on another host or port, or only on an IPv6/other address, the server gets connect failed. Test from the server:

ssh server 'curl -sI http://localhost:80 | head -1'

Use the address the service really listens on (ss -tlnp on the server shows it).

Cause 5: DNS or SOCKS clients asking for blocked destinations

With ssh -D 1080, each connection the browser makes opens a channel. If PermitOpen restricts destinations, sites not on the list fail with this message while others work.

Debugging

Run the client verbosely to see which channel request fails:

ssh -v -L 8080:localhost:80 user@server

On the server, journalctl -u ssh (or -u sshd) logs refused forwarding requests.

Last updated 2026-12-02.