centos 7.0 修改ssh預設串連22連接埠 和 添加防火牆firewalld 通過連接埠

來源:互聯網
上載者:User

標籤:

 

首先 先做的就是 修改ssh的預設連接埠22

需要修改檔案

/etc/ssh/sshd_config

使用命令

vi /etc/ssh/sshd_config

[[email protected] ~]# vi /etc/ssh/sshd_config#       $OpenBSD: sshd_config,v 1.90 2013/05/16 04:09:14 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:/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 override the# default value.# If you want to change the port on a SELinux system, you have to tell# SELinux about this change.# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER#Port 48489#AddressFamily any#ListenAddress 0.0.0.0#ListenAddress ::# The default requires explicit activation of protocol 1#Protocol 2# HostKey for protocol version 1#HostKey /etc/ssh/ssh_host_key# HostKeys for protocol version 2HostKey /etc/ssh/ssh_host_rsa_key#HostKey /etc/ssh/ssh_host_dsa_keyHostKey /etc/ssh/ssh_host_ecdsa_key# Lifetime and size of ephemeral version 1 server key#KeyRegenerationInterval 1h#ServerKeyBits 1024# Ciphers and keying#RekeyLimit default none# Logging# obsoletes QuietMode and FascistLogging#SyslogFacility AUTHSyslogFacility AUTHPRIV#LogLevel INFO# Authentication:#LoginGraceTime 2m#PermitRootLogin yes#StrictModes yes#MaxAuthTries 6#MaxSessions 10#RSAAuthentication yes#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2# but this is overridden so installations will only check .ssh/authorized_keysAuthorizedKeysFile      .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none

  先做就完成了 連接埠的修改 然後就需要讓防火牆通過這個連接埠

centos 7 預設使用的 是 firewalld  所以先看看是否運行

firewall-cmd --state

然後看下 先做預設通過的連接埠都有哪些

查看連接埠 規則

firewall-cmd --permanent --list-port

剛才測試 添加了 連接埠 現在刪除這個連接埠 參數--permanent 是永久配置 機子重啟依然有效

刪除連接埠

firewall-cmd --permanent --remove-port=48489/tcp

添加連接埠 到防火牆例外

firewall-cmd --permanent --zone=public --add-port=48489/tcp

 

然後通過putty ssh串連軟體連結一下就好了~

firewalld 參考資料

http://blog.csdn.net/smstong/article/details/39317277

 

centos 7.0 修改ssh預設串連22連接埠 和 添加防火牆firewalld 通過連接埠

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.