如何修改linux主機用於登錄的ssh默認耑口

字號+ 編輯: 种花家 修訂: 科学鼠辈 來源: Magicbreaker 2023-09-08 我要說兩句(0)

正常我們用ssh耑口遠程登錄都用22, 但是默認耑口總不是特別放心, 萬一被那些黑客掃描出來怎麽辦? 本文講述如何修改耑口。

如果不想被黑客拿无限字典工具测出来,最好连ssh端口也给改掉,毕竟不怕贼偷就怕贼惦记。天天扫你一百万遍也很浪费流量的。

aa566a3bj00qv3arv000wc000i600egm.jpg&thumbnail=650x2147483647&quality=80&type=jpg&refer=http___nimg.ws.126.jpg

修改的是 /etc/ssh/sshd_config 文件

[root@linux ~]# vi /etc/ssh/sshd_config
#       $OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp $
# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.
Port 22               //以前这个前面是有 # 号的,而且默认是 22 ,修改一下就ok了
#Protocol 2,1
#ListenAddress 0.0.0.0
#ListenAddress ::
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

重起ssh服务,修改端口才生效

[root@linux ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@linux ~]#

为了检验是否正确,可以使用 netstat -an 命令查看一下。

閲完此文,您的感想如何?
  • 有用

    3

  • 沒用

    0

  • 開心

    0

  • 憤怒

    0

  • 可憐

    0

1.如文章侵犯了您的版權,請發郵件通知本站,該文章將在24小時内刪除;
2.本站標注原創的文章,轉發時煩請注明來源;
3.交流群: PHP+JS聊天群

相關課文
  • Linux系統下word文档轉成pdf的辦法

  • ubuntu和debian安裝nginx或者tengine報錯, 找不到pcre依賴庫的解決辦法

  • linux終耑下借助awk命令查詢篩出網站access.log日志裡的統計信息

  • 常見的web中間件請求返回狀態碼

我要說說
網上賓友點評