Centos 開啟telnet-service服務

來源:互聯網
上載者:User

標籤:des   style   blog   http   io   ar   color   os   使用   

Centos 開啟telnet-service服務

1. 查看linux版本資訊:

[[email protected] ~]$ cat /etc/issue CentOS release 5.8 (Final) Kernel \r on an \m

2. 查看系統是否已安裝telnet-server,linux系統上預設已經安裝telnet-client(或telnet),而telnet-server需要手動安裝。

[[email protected] ~]$ rpm -qa | grep telnet telnet-0.17-39.el5

3. 安裝telnet-server,若系統已安裝,跳過此步。

方法一:下載RPM resource telnet-server,:http://rpmfind.net/linux/rpm2html/search.php?query=telnet-server

選擇相應版本的telnet-server下載;

安裝:# rpm -i telnet-server-0.17-39.el5.i386.rpm  #貌似還得單獨安裝xinetd.

方法二:(推薦使用)

# yum install telnet-server 

安裝完成後:

[[email protected] ~]$ rpm -qa | grep telnet telnet-0.17-39.el5 telnet-server-0.17-39.el5

4. 啟動telnet服務

方法一:System->Administration->Services 中,

在On Demand Services中選中telnet,

並在Background Services中選中xinetd,並點擊上面的Start,即在右側顯示:xinetd (pid  15986) is running...

最後Save & Quit.

方法二:編輯/etc/xinetd.d/telnet, 將其中的 disable = yes 的yes改為no.

修改後:

# default: on # description: The telnet server serves telnet sessions; it uses \ #       unencrypted username/password pairs for authentication. service telnet {         disable = no         flags           = REUSE         socket_type     = stream         wait            = no         user            = root         server          = /usr/sbin/in.telnetd         log_on_failure  += USERID }

方法三:使用chkconfig命令直接開啟

[[email protected] loong]# chkconfig telnet on

註:方法二和方法三,需要啟用xinetd服務。方法如下:

[[email protected] loong]# service xinetd restart Stopping xinetd:                                           [  OK  ] Starting xinetd:                                           [  OK  ]

或:

[[email protected] loong]# /etc/rc.d/init.d/xinetd restart Stopping xinetd:                                           [  OK  ] Starting xinetd:                                           [  OK  ]

5. 測試服務

[[email protected] loong]# telnet localhost Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is ‘^]‘. CentOS release 5.8 (Final) Kernel 2.6.18-308.1.1.el5 on an i686 login: loong Password:  Last login: Tue Apr 24 16:42:06 from 10.108.14.135 [[email protected] ~]$ exit logout  Connection closed by foreign host. [[email protected] loong]# 

註:預設情況下,系統只允許普通使用者telnet登入,不允許root使用者登入。

要想獲得root許可權,可以使用普通使用者登入,然後執行su,來獲得root許可權。

或使用一下方法,允許root登入telnet:

方法一:# mv /etc/securetty /etc/securetty.bak (不建議這種方法,測試完後再改回去吧!)

或先試圖使用root使用者登入,不成功,然後查看系統log:

telnet> o localhost Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is ‘^]‘. CentOS release 5.8 (Final) Kernel 2.6.18-308.1.1.el5 on an i686 login: root Password:  Login incorrect  login:      Login incorrect  login:  Login incorrect  login:  Connection closed by foreign host. [[email protected] loong]# tail -20 /var/log/secure Apr 24 17:32:58 localhost login: pam_securetty(remote:auth): access denied: tty ‘pts/1‘ is not secure ! Apr 24 17:33:03 localhost login: FAILED LOGIN 1 FROM localhost FOR root, Authentication failure

可以看到 access denied: tty ‘pts/1‘ is not secure !

所以將‘pts/1’添加到/etc/securetty中,即可實現telnet的root使用者登入。至於為什嗎?暫不清楚。

方法二:修改/etc/pam.d/remote,注釋掉:auth       required     pam_securetty.so

1 #%PAM-1.0 2 #auth       required     pam_securetty.so 3 auth       include      system-auth

註:不建議開放telnet的root登入,容易帶來安全隱患。

 

參考串連:

1. http://wenku.baidu.com/view/105544aedd3383c4bb4cd23d.html

2. win7下使用telnet命令:http://wenku.baidu.com/view/f0ff731152d380eb62946d9d.html

Centos 開啟telnet-service服務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.