1. 程式人生 > >CentOS 7.4安裝telnet服務端

CentOS 7.4安裝telnet服務端

一、檢查是否安裝telnet

  1. [[email protected] Solin]# rpm -qa | grep telnet
  2. [[email protected] Solin]#

二、安裝telnet客戶端、服務端(如果已安裝telnet則跳過此步驟)

yum -y install telnet*

三、檢查是否安裝xinetd

  1. [[email protected] Solin]# rpm -qa | grep xinetd
  2. [[email protected]
    Solin]#

四、安裝xinetd服務(如果已安裝xinetd則跳過此步驟)

yum -y install xinetd

五、telnet服務安裝之後,預設是不開啟服務,修改檔案/etc/xinetd.d/telnet來開啟服務

注:第一次修改,此檔案若不存在,可自己vim建立修改:修改 disable = yes 為 disable = no

  1. [[email protected] xinetd.d]# pwd
  2. /etc/xinetd.d
  3. [[email protected] xinetd.d]# ls
  4. chargen-dgram daytime-stream echo-dgram time-dgram
  5. chargen-stream discard-dgram echo-stream time-stream
  6. daytime-dgram discard-stream tcpmux-server
  7. [[email protected] xinetd.d]# vim telnet
  8. [[email protected] xinetd.d]# cat telnet
  9. # default: yes
  10. # description: The telnet server servestelnet sessions; it uses \
  11. # unencrypted username/password pairs for authentication.
  12. service telnet
  13. {
  14. flags = REUSE
  15. socket_type = stream
  16. wait = no
  17. user = root
  18. server =/usr/sbin/in.telnetd
  19. log_on_failure += USERID
  20. disable = no
  21. }
  22. [[email protected] xinetd.d]#

六、啟動telnet和依賴的xinetd服務

  1. [[email protected] xinetd.d]# systemctl restart xinetd.service
  2. [[email protected] xinetd.d]# ps -ef | grep xinetd #檢視xinetd是否啟動
  3. root 6100 1 0 10:20 ? 00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
  4. root 6159 3770 0 10:21 pts/1 00:00:00 grep --color=auto xinetd
  5. [[email protected] xinetd.d]# ps -ef | grep telnet #檢視telnet是否啟動
  6. root 6239 3770 0 10:22 pts/1 00:00:00 grep --color=auto telnet
  7. [[email protected] xinetd.d]#

七、測試telnet

在windows下開啟cmd命令列視窗,輸入telnet 192.168.1.10 回車,然後輸入使用者名稱密碼。

八、設定服務開機啟動

將xinetd服務加入開機自啟動:systemctl enable xinetd.service

將telnet服務加入開機自啟動:systemctl enable telnet.socket

閱讀更多