ssh服務 及禁止root使用者遠端登入

2021-10-23 06:37:34 字數 789 閱讀 9884

關閉防火牆與selinuxsystem

systemctl status firewalld.service (檢視防火牆狀態)

systemctl stop firewalld.service (臨時關閉)

systemctl disable firewalld(關閉開機自啟)

getenforce (檢視selinux狀態)

setenforce 0 (臨時關閉selinux)

vim /etc/selinux/config (編輯selinux配置檔案)

selinux=disable (修改選項,永久關閉)

或者sed -i 「s/selinux=enforcing/selinux=disabled/」 /etc/selinux/config;(永久關閉)

配置yum源並安裝

一般現在都自帶ssh,安裝個毛,省略

systemctl restart sshd

檢視狀態

systemctl status sshd

程序檢視方式

ps aux |grep sshd

埠檢視方式

netstat -lntp|grep sshd

開啟自啟動

systemctl enable sshd

修改配置檔案 vim /etc/ssh/sshd_config

開啟檔案第38行 修改以下內容

#permitrootlogin yes

permitrootlogin no

CentOS Linux 禁止root使用者遠端登入

在linux中,root幾乎擁有所有的許可權,一旦root使用者密碼外洩,對於伺服器而言將是致命的威脅,禁止root使用者通過ssh的方式遠端登入,這樣即使root使用者密碼外洩也能夠保障伺服器的安全。1 建立乙個普通使用者doiido並加入相應的組 注意 這裡必須要新建乙個使用者,否則將會造成無法...

Linux修改SSH埠和禁止Root遠端登陸設定

linux修改ssh埠22 vi etc ssh ssh config vi etc ssh sshd config 然後修改為port 8888 以root身份service sshd restart redhat as3 使用putty,埠8888 linux下ssh預設的埠是22,為了安全考慮...

linux修改ssh埠和禁止root遠端登陸設定

linux修改ssh埠和禁止root遠端登陸設定 linux修改ssh埠22 vi etc ssh ssh config vi etc ssh sshd config 然後修改為port 8888 以root身份service sshd restart redhat as3 使用putty,埠888...