SSH端口預設是22.但從安全方面考慮,建議修改這個端口。 端口的取值範圍是0 - 65535(即2的16次方),0到1024是系統使用的端口,如 http服務的端口80。我們可以使用的端口範圍:1024到65535。這個是socket規定的。
1.1修改端口配置檔案
vi /etc/ssh/ssh_config
vi /etc/ssh/sshd_config
取消Port前的#注釋,并将端口22改成65535
https://www.cndba.cn/Dave/article/648
1.2重新開機sshd服務
用root使用者執行:
[[email protected] ~]# service sshd restart
Stopping sshd:[OK]
Starting sshd:[OK]
此時在用SSH連接配接,就需要修改ssh的端口為6535才能連接配接了。
二.禁用Root遠端登陸
先在ssh的配置檔案裡修改Root遠端登陸參數。 禁用root遠端登陸。 然後建立一個遠端登陸使用者。 用這個使用者登陸之後,在切換到root使用者,拿到最高權限。https://www.cndba.cn/Dave/article/648
2.1建立普通權限的使用者
[[email protected] ~]# useradd ruser
[[email protected] ~]# passwd ruser
Changing password for user ruser.
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]#
2.2禁止ROOT遠端SSH登入
#vi /etc/ssh/sshd_config
PermitRootLogin yes
改為
PermitRootLogin no
2.3重新開機sshd服務
#service sshd restart
注意:這些修改不影響已經連接配接的SSH。隻對以後的的連接配接産生影響。https://www.cndba.cn/Dave/article/648
注意: 如果系統開起了iptables防火牆,那麼還需要把修改之後的端口号添加到防火牆裡面,不然SSH會連不上。 關于防火牆端口的添加,參考我的Blog:
https://www.cndba.cn/Dave/article/648
Linux iptables 防火牆 添加删除 端口
https://www.cndba.cn/Dave/article/648
整理自網絡
------------------------------------------------------------------------------
Blog:http://blog.csdn.net/tianlesoftware
網上資源:http://tianlesoftware.download.csdn.net
相關視訊:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
DBA1群:62697716(滿); DBA2群:62697977(滿)
DBA3群:62697850DBA超級群:63306533;
聊天 群:40132017
--加群需要在備注說明Oracle表空間和資料檔案的關系,否則拒絕申請
版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。