"channel 3: open failed: administratively prohibited: open failed"

The server refused your tunnel because its configuration forbids it. Your login is fine and the target was never contacted. Look for AllowTcpForwarding no, DisableForwarding yes or a PermitOpen list in sshd_config, including Match blocks, or for restrict, no-port-forwarding or permitopen on your key in authorized_keys. Only an administrator of that server can change it.

Updated . Every setting in the table was tested on a throwaway OpenSSH 10.0 server on Debian 13, with OpenSSH 10.3 on macOS as the client.

What you see

The session opens normally. The message appears when something uses the tunnel, not when you connect, and it appears in the terminal running ssh:

channel 3: open failed: administratively prohibited: open failed

The program using the tunnel fails separately, with its own message. An SSH client going through it, for example, prints kex_exchange_identification: read: Connection reset by peer.

Related forms from the same settings:

You ranOutput
ssh -L or ssh -Dchannel 3: open failed: administratively prohibited: open failed
ssh -W or ssh -Jchannel 0: open failed: administratively prohibited: open failed, then stdio forwarding failed
ssh -RWarning: remote port forwarding failed for listen port 8080

A different ending means a different problem. open failed: connect failed: Connection refused means the forward was allowed, but nothing is listening on the target host and port. Fix the target, not the configuration.

Which setting does it

WhereSettingBlocks
sshd_configAllowTcpForwarding no-L, -D, -W, -J and -R
sshd_configAllowTcpForwarding remote-L, -D, -W and -J
sshd_configAllowTcpForwarding local-R
sshd_configDisableForwarding yesAll forwarding, overriding the other settings
sshd_configPermitOpen 127.0.0.1:5432-L to any target not on the list
sshd_configPermitListen 9000-R on any port not on the list
authorized_keysrestrict or no-port-forwardingForwarding when logging in with that key
authorized_keyspermitopen="127.0.0.1:5432"-L with that key to any other target

Key options such as restrict and permitopen are explained line by line in the authorized_keys file explained.

Find which one applies to you

You need admin rights on the server. Ask sshd what it would apply to your user. Plain sshd -T ignores Match blocks, so include the connection details. In a test, the plain form said yes while the user's real value was no:

sudo sshd -T -C user=name,host=server,addr=203.0.113.10 | grep -iE '^(allowtcpforwarding|disableforwarding|permitopen|permitlisten)'

Also look at the options before the key in that user's file:

sudo cut -c1-60 ~name/.ssh/authorized_keys

The server's log names the refused target:

refused local port forward: originator 127.0.0.1 port 65535, target 127.0.0.1 port 22

Fix it

If it is not your server, ask its administrator. The block is usually deliberate, because a tunnel lets a user reach internal systems from outside. Explain which host and port you need so that they can allow only that.

If it is your server, prefer a narrow rule over turning forwarding on for everyone. Put this at the end of sshd_config:

Match User name
  AllowTcpForwarding local
  PermitOpen 127.0.0.1:5432

Then validate and reload. The service is ssh on Debian and Ubuntu and sshd on Red Hat style systems:

sudo sshd -t && sudo systemctl reload ssh

Keep in mind that for most keywords, sshd uses the first value it reads. If a line near the top says AllowTcpForwarding no, a yes further down does nothing. On Debian and Ubuntu, files in /etc/ssh/sshd_config.d/ are read first, so check there too. Run sshd -T again after the change to see the result.

For a restricted key, change the options on its line in authorized_keys. This takes effect on the next login, with no reload. For example, a key with restrict can get one tunnel back:

restrict,port-forwarding,permitopen="127.0.0.1:5432" ssh-ed25519 AAAA... user@laptop

See how to restrict an SSH key.

Questions

Does administratively prohibited mean my password or key is wrong?

No. You logged in successfully. The server's configuration refuses this particular forward, so only its settings or the options on your key can change the result.

How do I allow port forwarding for one user only?

Add a Match User name block at the end of sshd_config with AllowTcpForwarding local and a PermitOpen line for the target, then run sshd -t and reload the service.

Why does ssh -J fail with administratively prohibited?

A jump host needs TCP forwarding to pass your connection on. If it has AllowTcpForwarding no or remote, or your key has restrict, the -J connection fails the same way.

Sources

More in Error messages

All guides