博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Telnet命令在Linux / Unix中的用法
阅读量:2534 次
发布时间:2019-05-11

本文共 4138 字,大约阅读时间需要 13 分钟。

什么是Telnet? (What is Telnet ?)

Telnet is an old network protocol that is used to connect to remote systems over a TCP/IP network. It connects to servers and network equipment over port 23. Let’s take a look at Telnet command usage.

Telnet是一种旧的网络协议,用于通过TCP / IP网络连接到远程系统。 它通过端口23连接到服务器和网络设备。让我们看一下Telnet命令的用法。

免责声明 (Disclaimer)

  1. Telnet is not a secure protocol and is thus NOT RECOMMENDED!. This is because data sent over the protocol is unencrypted and can be intercepted by hackers.

    Telnet不是安全协议,因此不建议使用! 。 这是因为通过协议发送的数据未加密,并且可以被黑客拦截。
  2. Instead of using telnet, a more preferred protocol to use is SSH which is encrypted and more secure

    代替使用telnet,更优选使用的协议是SSH ,它经过加密且更安全

Let’s see how you can install and use the telnet protocol.

让我们看看如何安装和使用telnet协议。

安装Telnet (Installing Telnet)

In this section, we will walk you through the process of installing telnet in RPM and DEB systems.

在本节中,我们将引导您完成在RPM和DEB系统中安装telnet的过程。

在CentOS 7 / RHEL 7中安装Telnet (Installation of Telnet in CentOS 7 / RHEL 7)

To begin the installation process on the server, run the command

要在服务器上开始安装过程,请运行以下命令

# yum install telnet telnet-server -y

Sample Output

样本输出

Next, Start and enable the telnet service by issuing the command below

接下来,通过发出以下命令启动并启用telnet服务

# systemctl start telnet.socket# systemctl enable telnet.socket

Sample Output

样本输出

Next, allow port 23 which is the native port that telnet uses on the firewall.

接下来,允许端口23,这是telnet在防火墙上使用的本机端口。

# firewall-cmd --permanent --add-port=23/tcp

Finally, reload the firewall for the rule to take effect.

最后,重新加载防火墙以使规则生效。

# firewall-cmd --reload

Sample Output

样本输出

To verify the status of telnet run

验证telnet的运行状态

# systemctl status telnet.socket

Sample Output

样本输出

Telnet protocol is now ready for use. Next, we are going to create a login user.

Telnet协议现在可以使用了。 接下来,我们将创建一个登录用户。

创建登录用户 (Creating a login user)

In this example, we will create a login user for logging in using the telnet protocol.

在此示例中,我们将创建一个登录用户,以使用telnet协议登录。

# adduser telnetuser

Create a password for the user.

为用户创建密码。

# passwd telnetuser

Specify the password and confirm.

指定密码并确认。

To use telnet command to log in to a server, use the syntax below.

要使用telnet命令登录到服务器,请使用以下语法。

$ telnet server-IP address

For example

例如

$ telnet 38.76.11.19

In the black console, specify the username and password.

在黑色控制台中,指定用户名和密码。

To login using putty, enter the server’s IP address and click on the ‘Telnet’ radio button as shown.

要使用腻子登录,请输入服务器的IP地址,然后单击“ Telnet”单选按钮,如图所示。

Finally, click on the ‘Open’ button. On the console screen, provide the username and password of the user

最后,点击“打开”按钮。 在控制台屏幕上,提供用户的用户名和密码

在Ubuntu 18.04中安装Telnet (Installation of Telnet in Ubuntu 18.04)

To install telnet protocol in Ubuntu 18.04 execute:

要在Ubuntu 18.04中安装telnet协议,请执行:

$ sudo apt install telnetd -y

Sample Output

样本输出

To check whether telnet service is running, execute the command.

要检查telnet服务是否正在运行,请执行命令。

$ systemctl status inetd

Sample Output

样本输出

Next, we need to open port 23 in ufw firewall.

接下来,我们需要在ufw防火墙中打开端口23。

$ ufw allow 23/tcp

Sample Output

样本输出

Finally, reload the firewall to effect the changes.

最后,重新加载防火墙以使更改生效。

$ ufw reload

Telnet has been successfully installed and ready for use. Like in the previous example in CentOS 7, you need to create a login user and log in using the same syntax.

Telnet已成功安装并可以使用。 与CentOS 7中的上一个示例一样,您需要创建一个登录用户并使用相同的语法登录。

使用telnet检查开放端口 (Using telnet to check for open ports)

Telnet can also be used to check if a specific port is open on a server. To do so, use the syntax below.

Telnet也可以用于检查服务器上是否打开了特定端口。 为此,请使用以下语法。

$ telnet server-IP port

For example, to check if port 22 is open on a server, run

例如,要检查服务器上端口22是否打开,请运行

$ telnet 38.76.11.19  22

Sample Output

样本输出

摘要 (Summary)

This tutorial is an educational guide that shows you how to use telnet protocol. We HIGHLY DISCOURAGE the use of telnet due to the high-security risks it poses due to lack of encryption. SSH is the recommended protocol when connecting to remote systems. The data sent over SSH is encrypted and kept safe from hackers.

本教程是一本教育性指南,向您展示如何使用telnet协议。 我们强烈不鼓励使用telnet,这是由于缺乏加密会带来很高的安全风险。 连接到远程系统时,建议使用SSH协议。 通过SSH发送的数据经过加密,可以防止黑客入侵。

翻译自:

转载地址:http://ojlzd.baihongyu.com/

你可能感兴趣的文章
JSP开发模式
查看>>
我的Android进阶之旅------>Android嵌入图像InsetDrawable的使用方法
查看>>
Detours信息泄漏漏洞
查看>>
win32使用拖放文件
查看>>
Android 动态显示和隐藏软键盘
查看>>
raid5什么意思?怎样做raid5?raid5 几块硬盘?
查看>>
【转】how can i build fast
查看>>
null?对象?异常?到底应该如何返回错误信息
查看>>
django登录验证码操作
查看>>
(简单)华为Nova青春 WAS-AL00的USB调试模式在哪里开启的流程
查看>>
图论知识,博客
查看>>
[原创]一篇无关技术的小日记(仅作暂存)
查看>>
20145303刘俊谦 Exp7 网络欺诈技术防范
查看>>
原生和jQuery的ajax用法
查看>>
iOS开发播放文本
查看>>
20145202马超《java》实验5
查看>>
JQuery 事件
查看>>
main(argc,argv[])
查看>>
在线教育工具—白板系统的迭代1——bug监控排查
查看>>
121. Best Time to Buy and Sell Stock
查看>>