在 Ubuntu 上开启 Telnet 服务一般步骤如下(以 Ubuntu 20.04 / 22.04 为例)。
⚠️ 注意:Telnet 是明文协议,不安全,生产环境强烈建议使用 SSH。
Ubuntu 默认不安装 Telnet 服务器,需要手动安装:
sudo apt update
sudo apt install telnetd
安装完成后,系统会自动启动 inetd 或 xinetd 来管理 telnet 服务。
sudo systemctl status inetd
或
sudo systemctl status xinetd
如果未启动,可手动启动:
sudo systemctl start inetd
sudo systemctl enable inetd
Telnet 默认使用 23 端口:
ss -lntp | grep 23
或
netstat -lntp | grep 23
看到类似:
LISTEN 0 128 0.0.0.0:23
说明服务已开启。
sudo ufw allow 23/tcp
sudo ufw reload
查看状态:
sudo ufw status
telnet localhost
telnet 服务器IP
登录时使用系统用户账号和密码。
可安装 openbsd-inetd:
sudo apt install openbsd-inetd
✅ 推荐方案:使用 SSH
sudo apt install openssh-server
SSH 默认端口 22,加密、安全、功能更强。
如果你需要:
可以告诉我你的 Ubuntu 版本,我可以给你更精确的方案。