ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÈçºÎÔÚCentOS/RHEL Linux 6 & 7 ÉÏ°²×°Telnet

·¢²¼Ê±¼ä:2017-12-22 17:09:28À´Ô´:ºìÁª×÷Õß:Ronny
µ¼¶Á ÔÚ¹«Íø(WAN)ÖÐʹÓÃTelnetÊǷdz£²»ºÃµÄÏë·¨¡£Ëü»áÒÔÃ÷Îĵĸñʽ´«ÊäµÇÈëÊý¾Ý¡£Ã¿¸öÈ˶¼¿ÉÒÔ¿´µ½Ã÷ÎÄ¡£Èç¹ûÄ㻹ÊÇÐèÒªTelnet£¬Ç¿ÁÒ½¨ÒéÄãÖ»ÔÚ¾ÖÓòÍøÄÚ²¿Ê¹Óá£Äã¿ÉÒÔʹÓÃSSH×÷ΪÌæ´ú·½·¨¡£µ«ÊÇÈ·±£²»ÒªÓÃrootÓû§µÇ¼¡£
TelnetÊÇʲô£¿
Telnet ÊÇÓÃÓÚͨ¹ýTCP/IPÍøÂçÔ¶³ÌµÇ¼¼ÆËã»úµÄЭÒé¡£Ò»µ©ÓëÔ¶³Ì¼ÆËã»ú½¨Á¢ÁËÁ¬½Ó£¬Ëü¾Í»á³ÉΪһ¸öÐéÄâÖÕ¶ËÇÒÔÊÐíÄãÓëÔ¶³Ì¼ÆËã»úͨÐÅ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇ»áչʾÈçºÎ°²×°Telnet²¢ÇÒÈçºÎͨ¹ýTelnet·ÃÎÊÔ¶³Ìϵͳ¡£

ÈçºÎÔÚCentOS/RHEL Linux 6 & 7 ÉÏ°²×°TelnetÈçºÎÔÚCentOS/RHEL Linux 6 & 7 ÉÏ°²×°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
}
±£´æ²¢Í˳öÎļþ¡£¼ÇסÎÒÃDz»±ØÔÚ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
¼ÓÈëÈçÏÂÐС°-A INPUT -p tcp -m state --state NEW --dport 23 -j ACCEPT¡±£º

# 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µØÖ·¡£
ÏÖÔÚÄã¾Í¿ÉÒÔÁ¬½Óµ½ÄãµÄ·þÎñÆ÷ÉÏÁË¡£¾ÍÊÇÕâÑù¡£
±¾ÎÄתÔØ×Ôhttp://www.linuxprobe.com/centos-rhel-telnet.html

Ãâ·ÑÌṩ×îÐÂLinux¼¼Êõ½Ì³ÌÊé¼®£¬Îª¿ªÔ´¼¼Êõ°®ºÃÕßŬÁ¦×öµÃ¸ü¶à¸üºÃ£¬¿ªÔ´Õ¾µã£ºhttp://www.linuxprobe.com/
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. Ronny ÓÚ 2017-12-22 17:09:41·¢±í:

    ÔÚCentOS/RHEL Linux 6 & 7 ÉÏ°²×°Telnet