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

DNS record for SSH (docker)

· 52CE 我爱测

I have a docker container which bind the port 2222:22. It's possible to connect using ssh -T sub.example.com -p 2222 . I'm looking for a way to access ssh the container without specify the port number. I thought this could be don…

问题原文

原帖链接 · Maximilian Ebel · CC BY-SA 4.0

I have a docker container which bind the port 2222:22. It's possible to connect using ssh -T sub.example.com -p 2222.

I'm looking for a way to access ssh the container without specify the port number. I thought this could be done with a DNS record.

I set a DNS record SRV _ssh._tcp.sub 5 10022 sub.example.com to my domain in the admin interface of my provider, this does not work.

Is there a way to do that?

社区高分解答

原帖链接 · Tomek · CC BY-SA 4.0

I am using wrapsrv together with ProxyCommand and socat to use SRV records for determination of connection endpoint:

Host *.my.domain
        ProxyCommand    wrapsrv _ssh._tcp.%h socat STDIO TCP:%%h:%%p

The advantage is that both scp and sftp should use it from ssh config file.

Please note that SRV record needs THREE integers: priority, weight and port, not two as you are showing in your question.

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

资料来源与适用范围

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

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

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