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

ssh gateway which can proxy to upstream servers based on user name?

· 52CE 我爱测

Every user has a dedicated machine, but is not exposed to the outside world. The 'gateway' is the only system that is exposed. The user has no idea of this setup. He just does ssh username@gateway which should be equivalent to ss…

问题原文

原帖链接 · svr · CC BY-SA 3.0

Every user has a dedicated machine, but is not exposed to the outside world. The 'gateway' is the only system that is exposed.

The user has no idea of this setup. He just does ssh username@gateway which should be equivalent to ssh [email omitted].

Can we configure a gateway sshd with which we can achieve this? Each machine has a single user. So, there can't be any confusion in determining the upstream server.

已采纳解答

原帖链接 · Jakuje · CC BY-SA 3.0

Setting up

Match group proxyUsers
  ForceCommand /bin/connect_to_user_machine

and having /bin/connect_to_user_machine

#!/bin/bash
ssh $USER@$USER.internal $SSH_ORIGINAL_COMMAND

will do the job

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

资料来源与适用范围

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

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

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