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

Non standard ssh port: should I edit /etc/services?

· 52CE 我爱测

On a *nix system, when configuring ssh to listen on non standard port, should I also edit /etc/services to reflect that. I would think it should be done, so tools that use it (such as ufw ) will recognize the correct port for ssh…

问题原文

原帖链接 · Chen Levy · CC BY-SA 3.0

On a *nix system, when configuring ssh to listen on non standard port, should I also edit /etc/services to reflect that.

I would think it should be done, so tools that use it (such as ufw) will recognize the correct port for ssh, but I see very little mention of it in documentation and tutorials.

So is it considered good or bad practise to edit /etc/services, and if not, why?

已采纳解答

原帖链接 · Håkan Lindqvist · CC BY-SA 3.0

I don't think it makes sense to edit /etc/services in such a case. The world will not change ssh ports with you, and all programs that look up service names to port numbers on your machine would get the incorrect port for ssh.

If anything, it might make more sense to add an entry of your own for your non-standard ssh port, eg myssh <yourport>/tcp if you want a service name that you can use.


Then there's obviously the age-long debate of whether changing ports like that to "hide" services actually serves any real purpose beyond reducing log spam.

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

资料来源与适用范围

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

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

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