大网数据广告活动
服务器运维问答

Working example of multiple permitopen options in authorized_keys

· 52CE 我爱测

I have a working key in .ssh/authorized_keys with a single permitopen option configured. I went to add an additional permitopen and it does not allow tunnels to the new server. The documentation says: Multiple PermitOpen options …

问题原文

原帖链接 · Shawn McGough · CC BY-SA 3.0

I have a working key in .ssh/authorized_keys with a single permitopen option configured. I went to add an additional permitopen and it does not allow tunnels to the new server. The documentation says:

Multiple PermitOpen options may be applied to the same public key if they are separated by commas and thus a key can allow multiple ports.

However, the documentation does not show any examples. Can someone provide a working example? I've tried both the following:

permitopen="host-1:3389",permitopen="host-2:3389" ssh-rsa AAAAC...

and

permitopen="host-1:3389,host-2:3389" ssh-rsa AAAAC...

已采纳解答

原帖链接 · Shawn McGough · CC BY-SA 3.0

I've gotten it to work. The first example above works.

permitopen="host-1:3389",permitopen="host-2:3389" ssh-rsa AAAAC...

In my case it was not working because the host name is case-sensitive.

I was using the following command to connect:

ssh -f user@tunneler -L 10001:host-1:3389 -L 10002:HOST-2:3389 -N

which failed due to the capitalization of the second hostname.

ssh -f user@tunneler -L 10001:host-1:3389 -L 10002:host-2:3389 -N worked.

It must match exactly what is in the permitopen option.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-06-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。