歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> Linux SSH 安全策略 限制 IP 登錄方法

Linux SSH 安全策略 限制 IP 登錄方法

日期:2017/3/2 16:31:51   编辑:Linux服務器

方法一:

首先需要限制登錄的ip(或者如果需要自己本地登錄,查看最後登錄ip即可)

Vim /etc/hosts.allow

輸入

sshd:114.80.100.159:allow

vim /etc/hosts.deny

輸入(表示除了上面允許的,其他的ip 都拒絕登陸ssh)
sshd:ALL

最後sshd重啟

service sshd restart


方法二:

比如說你只允許114.80.100.159這個IP進入,其它都禁止:

vim /etc/ssh/sshd_config

添加一行:

allowusers [email protected]

注:xxx為你用來登入服務器的用戶名

最後sshd重啟

service sshd restart

Copyright © Linux教程網 All Rights Reserved