日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

SSH限制ip登陆

發(fā)布時(shí)間:2025/3/15 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SSH限制ip登陆 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

linux限制IP訪問(wèn)ssh

在/etc/hosts.allow輸入???
(其中192.168.10.88是你要允許登陸ssh的ip,或者是一個(gè)網(wǎng)段192.168.10.0/24)???
sshd:192.168.10.88:allow???
????
在/etc/hosts.deny輸入(表示除了上面允許的,其他的ip?? 都拒絕登陸ssh)???
sshd:ALL

?

更改端口
vi /etc/ssh/sshd_config
port 3333


最后一行加上ip
allowusers?root@ip?? ------------------允許某個(gè)ip用什么帳戶(hù)登陸

?

實(shí)際示例:

cat /etc/hosts.allow # # hosts.allow This file contains access rules which are used to # allow or deny connections to network services that # either use the tcp_wrappers library or that have been # started through a tcp_wrappers-enabled xinetd. # # See 'man 5 hosts_options' and 'man 5 hosts_access' # for information on rule syntax. # See 'man tcpd' for information on tcp_wrappers # sshd:192.168.0.0/24:allow sshd:172.20.18.0/24:allow sshd:10.8.0.0/24:allow cat /etc/hosts.deny # # hosts.deny This file contains access rules which are used to # deny connections to network services that either use # the tcp_wrappers library or that have been # started through a tcp_wrappers-enabled xinetd. # # The rules in this file can also be set up in # /etc/hosts.allow with a 'deny' option instead. # # See 'man 5 hosts_options' and 'man 5 hosts_access' # for information on rule syntax. # See 'man tcpd' for information on tcp_wrappers # sshd:ALL

systemctl restart sshd

驗(yàn)證只能內(nèi)網(wǎng)登錄 ,外網(wǎng)無(wú)法登錄

?

?

總結(jié)

以上是生活随笔為你收集整理的SSH限制ip登陆的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。