mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
translated
This commit is contained in:
parent
24ce934e9e
commit
3b0362d704
@ -1,160 +0,0 @@
|
||||
Translating-----geekpi
|
||||
|
||||
Installing Telnet In CentOS/RHEL/Scientific Linux 6 & 7
|
||||
================================================================================
|
||||
#### Disclaimer: ####
|
||||
|
||||
Before installing and using Telnet, keep the following in mind.
|
||||
|
||||
- Using Telnet in public network(WAN) is very very bad idea. It transmits login data in the clear format. Everything will be sent in plain text.
|
||||
- If you still need Telnet, It is highly recommended use it in the local area network only.
|
||||
- Alternatively, you can use **SSH**. But make sure you’ve disabled root login in SSH.
|
||||
|
||||
### What Is Telnet? ###
|
||||
|
||||
[Telnet][1] is a network protocol which is used to connect to remote computers over TCP/IP network. Once you establish a connection to the remote computer, it becomes a virtual terminal and will allow you to communicate with the remote host from your local system.
|
||||
|
||||
In this brief tutorial, let us see how to install Telnet, and how to access remote systems via Telnet.
|
||||
|
||||
### Installation ###
|
||||
|
||||
Open your terminal and type the following command to install telnet:
|
||||
|
||||
yum install telnet telnet-server -y
|
||||
|
||||
Now, the telnet has been installed in your server. Next, edit the telnet configuration file **/etc/xinetd.d/telnet**;
|
||||
|
||||
vi /etc/xinetd.d/telnet
|
||||
|
||||
Set **disable = no**:
|
||||
|
||||
# default: on
|
||||
# description: The telnet server serves telnet sessions; it uses \
|
||||
# unencrypted username/password pairs for authentication.
|
||||
service telnet
|
||||
{
|
||||
flags = REUSE
|
||||
socket_type = stream
|
||||
wait = no
|
||||
user = root
|
||||
server = /usr/sbin/in.telnetd
|
||||
log_on_failure += USERID
|
||||
disable = no
|
||||
}
|
||||
|
||||
Save and quit the file. Be mindful that you don’t have do this step in CentOS 7.
|
||||
|
||||
Now restart the telnet service using the following command:
|
||||
|
||||
On CentOS 6.x systems:
|
||||
|
||||
service xinetd start
|
||||
|
||||
Make this service to start automatically on every reboot:
|
||||
|
||||
On CentOS 6:
|
||||
|
||||
chkconfig telnet on
|
||||
chkconfig xinetd on
|
||||
|
||||
On CentOS 7:
|
||||
|
||||
systemctl start telnet.socket
|
||||
systemctl enable telnet.socket
|
||||
|
||||
Allow the telnet default port **23** through your firewall and Router. To allow the telnet port through firewall, Edit file **/etc/sysconfig/iptables** on CentOS 6.x systems:
|
||||
|
||||
vi /etc/sysconfig/iptables
|
||||
|
||||
Add the line as shown in red color:
|
||||
|
||||
# Firewall configuration written by system-config-firewall
|
||||
# Manual customization of this file is not recommended.
|
||||
*filter
|
||||
:INPUT ACCEPT [0:0]
|
||||
:FORWARD ACCEPT [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
-A INPUT -p icmp -j ACCEPT
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
-A INPUT -p tcp -m state --state NEW --dport 23 -j ACCEPT
|
||||
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
|
||||
-A INPUT -j REJECT --reject-with icmp-host-prohibited
|
||||
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
|
||||
COMMIT
|
||||
|
||||
Save and exit the file. Restart iptables service:
|
||||
|
||||
service iptables restart
|
||||
|
||||
On CentOS 7, run the following commands to enable telnet service through firewall.
|
||||
|
||||
firewall-cmd --permanent --add-port=23/tcp
|
||||
firewall-cmd --reload
|
||||
|
||||
Thats it. Now telnet server is ready to use.
|
||||
|
||||
#### Creating users ####
|
||||
|
||||
Create a test user, for example “**sk**” with password “**centos**“:
|
||||
|
||||
useradd sk
|
||||
passwd sk
|
||||
|
||||
#### Client Side Configuration ####
|
||||
|
||||
Install telnet package:
|
||||
|
||||
yum install telnet
|
||||
|
||||
On DEB based systems:
|
||||
|
||||
sudo apt-get install telnet
|
||||
|
||||
Now, open Terminal, and try to access your server(remote host).
|
||||
|
||||
If your client is Linux system, open the terminal and type the following command to connect to telnet server.
|
||||
|
||||
telnet 192.168.1.150
|
||||
|
||||
Enter username and password which we have created in the server:
|
||||
|
||||
Sample output:
|
||||
|
||||
Trying 192.168.1.150...
|
||||
Connected to 192.168.1.150.
|
||||
Escape character is '^]'.
|
||||
|
||||
Kernel 3.10.0-123.13.2.el7.x86_64 on an x86_64
|
||||
server1 login: sk
|
||||
Password:
|
||||
[sk@server1 ~]$
|
||||
|
||||
As you see in the above output, the remote system has been successfully accessed from the local machine.
|
||||
|
||||
If your client is windows system, then go to **Start -> Run -> Command Prompt**.
|
||||
|
||||
In the command prompt, type the command:
|
||||
|
||||
telnet 192.168.1.150
|
||||
|
||||
Where **192.168.1.150** is remote host IP address.
|
||||
|
||||
Now you will be able to connect to your server.
|
||||
|
||||
That’s it.
|
||||
|
||||
Cheers!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/installing-telnet-centosrhelscientific-linux-6-7/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.unixmen.com/author/sk/
|
||||
[1]:http://en.wikipedia.org/wiki/Telnet
|
@ -0,0 +1,159 @@
|
||||
在CentOS/RHEL/Scientific Linux 6 & 7 上安装Telnet
|
||||
================================================================================
|
||||
|
||||
#### 声明: ####
|
||||
|
||||
在安装和使用Telnet之前,需要记住以下几点。
|
||||
|
||||
- 在公网(WAN)中使用Telnet是非常不好的想法。它会以明文的格式传输登入数据。每个人都可以看到明文。
|
||||
- 如果你还是需要Telnet,强烈建议你只在局域网内部使用。
|
||||
- 你可以使用**SSH**作为替代方法。但是确保不要用root用户登录。
|
||||
|
||||
### Telnet是什么? ###
|
||||
|
||||
[Telnet][1] 是用于通过TCP/IP网络远程登录计算机的协议。一旦与远程计算机建立了连接,它就会成为一个虚拟终端且允许你与远程计算机通信。
|
||||
|
||||
在本篇教程中,我们会展示如何安装Telnet并且如何通过Telnet访问远程系统。
|
||||
|
||||
### 安装 ###
|
||||
|
||||
打开终端并输入下面的命令来安装telnet:
|
||||
|
||||
yum install telnet telnet-server -y
|
||||
|
||||
现在telnet已经安装在你的服务器上了。接下来编辑文件**/etc/xinetd.d/telnet**:
|
||||
|
||||
vi /etc/xinetd.d/telnet
|
||||
|
||||
设置 **disable = no**:
|
||||
|
||||
# default: on
|
||||
# description: The telnet server serves telnet sessions; it uses \
|
||||
# unencrypted username/password pairs for authentication.
|
||||
service telnet
|
||||
{
|
||||
flags = REUSE
|
||||
socket_type = stream
|
||||
wait = no
|
||||
user = root
|
||||
server = /usr/sbin/in.telnetd
|
||||
log_on_failure += USERID
|
||||
disable = no
|
||||
}
|
||||
|
||||
保存并退出文件。记住我们不必在CentOS 7做这步。
|
||||
|
||||
接下来使用下面的命令重启telnet服务:
|
||||
|
||||
在CentOS 6.x 系统中:
|
||||
|
||||
service xinetd start
|
||||
|
||||
让这个服务在每次重启时都会启动:
|
||||
|
||||
在CentOS 6上:
|
||||
|
||||
chkconfig telnet on
|
||||
chkconfig xinetd on
|
||||
|
||||
在CentOS 7上:
|
||||
|
||||
systemctl start telnet.socket
|
||||
systemctl enable telnet.socket
|
||||
|
||||
让telnet的默认端口**23**可以通过防火墙和路由器。要让telnet端口可以通过防火墙,在CentOS 6.x系统中编辑下面的文件:
|
||||
|
||||
vi /etc/sysconfig/iptables
|
||||
|
||||
加入红色显示的行:
|
||||
|
||||
# Firewall configuration written by system-config-firewall
|
||||
# Manual customization of this file is not recommended.
|
||||
*filter
|
||||
:INPUT ACCEPT [0:0]
|
||||
:FORWARD ACCEPT [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
-A INPUT -p icmp -j ACCEPT
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
-A INPUT -p tcp -m state --state NEW --dport 23 -j ACCEPT
|
||||
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
|
||||
-A INPUT -j REJECT --reject-with icmp-host-prohibited
|
||||
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
|
||||
COMMIT
|
||||
|
||||
保存并退出文件。重启iptables服务:
|
||||
|
||||
service iptables restart
|
||||
|
||||
在CentOS 7中,运行下面的命令让telnet服务可以通过防火墙。
|
||||
|
||||
firewall-cmd --permanent --add-port=23/tcp
|
||||
firewall-cmd --reload
|
||||
|
||||
就是这样。现在telnet服务就可以使用了。
|
||||
|
||||
#### 创建用户 ####
|
||||
|
||||
创建一个测试用户,比如用户名是“**sk**”,密码是“**centos**“:
|
||||
|
||||
useradd sk
|
||||
passwd sk
|
||||
|
||||
#### 客户端配置 ####
|
||||
|
||||
安装telnet包:
|
||||
|
||||
yum install telnet
|
||||
|
||||
在基于DEB的系统中:
|
||||
|
||||
sudo apt-get install telnet
|
||||
|
||||
现在,打开终端,尝试访问你的服务器(远程主机)。
|
||||
|
||||
如果你的客户端是Linux系统,打开终端并输入下面的命令来连接到telnet服务器上。
|
||||
|
||||
telnet 192.168.1.150
|
||||
|
||||
输入服务器上已经创建的用户名和密码:
|
||||
|
||||
示例输出:
|
||||
|
||||
Trying 192.168.1.150...
|
||||
Connected to 192.168.1.150.
|
||||
Escape character is '^]'.
|
||||
|
||||
Kernel 3.10.0-123.13.2.el7.x86_64 on an x86_64
|
||||
server1 login: sk
|
||||
Password:
|
||||
[sk@server1 ~]$
|
||||
|
||||
如你所见,已经成功从本地访问远程主机了。
|
||||
|
||||
如果你的系统是windows,进入**开始 -> 运行 -> 命令提示符**。
|
||||
|
||||
在命令提示符中,输入命令:
|
||||
|
||||
telnet 192.168.1.150
|
||||
|
||||
**192.168.1.150**是远程主机IP地址。
|
||||
|
||||
现在你就可以连接到你的服务器上了。
|
||||
|
||||
就是这样。
|
||||
|
||||
干杯!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/installing-telnet-centosrhelscientific-linux-6-7/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.unixmen.com/author/sk/
|
||||
[1]:http://en.wikipedia.org/wiki/Telnet
|
Loading…
Reference in New Issue
Block a user