CentOs7開啟telnet


一、安裝telnet

  1、檢測xinetd是否安裝

    telnet服務由xinetd守護,安裝前先看看xinetd是否安裝了.

    [root@localhost ~]# rpm -qa xinetd

    若未安裝輸入yum install xinetd

  2、安裝telnet服務端

    [root@localhost ~]#yum install telnet-server 

  3、安裝telnet客戶端

    [root@localhost ~]#yum install telnet

二、配置telnet

  設置開機啟動 [root@locahost ~]#chkconfig telnet on

  修改配置文件 vi /etc/xinetd.d/telnet  將”disable= yes”改成” disable=no” 

  如果沒有該文件則創建該文件,內容為:

# default: yes
# description: The telnet server servestelnet 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
}

為了安全需要,可以在該文件中配置連接本機的各種限制,如IP和開放時間

 

三、激活服務

  重新啟動守護進程: [root@locahost ~]#service xinetd restart 

四、開放端口

  查看23端口是否開啟: [root@localhost ~]#netstat -tnl |grep 23 

  如果沒有返回內容,可能是防火牆沒有開放23端口,

  [root@localhost ~]# firewall-cmd --query-port=23/tcp

  no

  顯示23端口沒有開啟使用下面命令開啟23端口(如果提示找不到這個命令使用yum install firewalld安裝)

  [root@localhost ~]# firewall-cmd --zone=public --add-port23/tcp --permanent

  success

  重新加載

  [root@localhost ~]# firewall-cmd --complete-reload

  success

  再次查詢

  [root@localhost ~]# firewall-cmd --query-port=23/tcp

  yes

  再次執行[root@localhost ~]#netstat -tnl |grep 23 

  如果還沒有返回內容可以嘗試一下重啟.....

五、測試

  telnet localhost


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM