CentOS下telnet允許root使用者登入

來源:互聯網
上載者:User

預設情況下,linux不允許root使用者以telnet方式登入linux主機,若要允許root使用者登入,可採取以下3種方法之一:

1、修改login檔案

RedHat中對於遠程登入的限制體現在/etc/pam.d/login檔案中,如果把限制的內容登出掉,那麼限制將不起作用。

#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system-auth
#account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session include system-auth
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session optional pam_keyinit.so force revoke
~

2、移除securetty檔案

驗證規則設定在/etc/security檔案中,該檔案定義root使用者只能在tty1-tty6的終端上記錄,刪除該檔案或者將其改名即可避開驗證規則實現root使用者遠程登入。

[root@nodel ~]# mv /etc/securetty /etc/securetty.bak

3、修改securetty檔案

[root@nodel ~]# vim /etc/securetty
console
vc/1
....

....

vc/10
tty1
....

tty11

pts/1
pts/2
....
....
....
pts/11

一般不建議直接用root使用者遠程通過telnet登陸系統,因為telnet在資料轉送過程採用明文方式,如果,資料包被人截獲,將會很容易擷取root使用者的登陸口令;還是建議以普通使用者通過telnet遠程登陸,然後su到root,這樣相對比較安全。如果非要用root使用者遠端連線,建議採用SSH.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.