首先 先做的就是 修改ssh的默认端口22

需要修改文件

/etc/ssh/sshd_config

使用命令

vi /etc/ssh/sshd_config

[root@localhost ~]# 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 2
HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /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 AUTH
SyslogFacility 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_keys
AuthorizedKeysFile .ssh/authorized_keys #AuthorizedPrincipalsFile none #AuthorizedKeysCommand none

  先做就完成了 端口的修改 然后就需要让防火墙通过这个端口

具体操作 就是 按 I 键,进入插入编辑,找到Port前面的#去掉 ,改成自己需要的端口号

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 通过端口的更多相关文章

  1. CentOS 6.0修改ssh远程连接端口

    转自:系统运维 » CentOS 6.0修改ssh远程连接端口 实现目的:把ssh默认远程连接端口修改为2222 方法如下: 1.编辑防火墙配置:vi /etc/sysconfig/iptables ...

  2. CentOS 7.0 更改SSH 远程连接 端口号

    许多学习过redhat 7的同学们,在使用centos的时候总会遇到一些问题,因为centos在安装时会默认开启一些服务,今天我们就来更改下centos 7.0的SSH端口. 操作步骤: 远程登录到c ...

  3. centos 5.11修改ssh默认端口号

    查看下服务器端口号范围: # sysctl -a|grep ip_local_port_range    net.ipv4.ip_local_port_range = 32768    61000 新 ...

  4. RHEL7 修改SSH默认端口及修改SELinux运行状态

    RHEL7安装后,默认开启SSH服务以便远程配置,但默认端口22并不安全,一般不建议使用默认端口,那就修改SSH默认端口.在sshd_config里面的修改RHEL7.0上修改和7.0以下类似,但要注 ...

  5. CentOS7修改SSH远程连接端口

      CentOS7修改SSH远程连接端口              

  6. Linux Centos 6.9中SSH默认端口修改的坑

    关于Linux Centos6.5的SSH默认端口修改的博客有一大堆,我在这里就不啰嗦了,但是面对Centos 6.9,就会发现有一个巨坑: 修改iptables之后执行下面的命令后: # servi ...

  7. LINUX 修改SSH默认22端口的方法

    首先修改配置文件 vi /etc/ssh/sshd_config 找到#Port 22一段,这里是标识默认使用22端口,修改为如下: Port 22 Port 50000 然后保存退出 执行/etc/ ...

  8. CentOs 6.5设置使用私钥登录关闭ssh的密码登录修改ssh默认端口

    使用SecureCRT工具创建RSA公钥和私钥 [选项]=>[会话选项] 然后在弹出对话框中选择[公钥]然后点击[属性]: 在弹出窗口中选中[使用会话公钥设置],点击[创建身份文件]按钮: 然后 ...

  9. centos修改ssh默认端口号的方法

    修改/etc/ssh/sshd_config配置文件(注意:这里是sshd_config,而不是ssh_config) vi /etc/ssh/sshd_config 在sshd_config文件中添 ...

随机推荐

  1. lucene-查询query->TermQuery按词条搜索

     TermQuery是最简单.也是最常用的Query.TermQuery可以理解成为“词条搜索”,在搜索引擎中最基本的搜索就是在索引中搜索某一词条,而TermQuery就是用来完成这项工作的. 在Lu ...

  2. Jquery ui autocomplete简单api

    重要说明:与配置选项类似,Autocomplete插件的方法也不是直接调用,而且通过autocomplete()方法进行间接调用.例如: $("#title").autocompl ...

  3. Java+FlexPaper+swfTools仿百度文库文档在线预览系统设计与实现

    笔者最近在给客户开发文档管理系统时,客户要求上传到管理系统的文档(包括ppt,word,excel,txt)只能预览不允许下载.笔者想到了百度文库和豆丁网,百度文库和豆丁网的在线预览都是利用flash ...

  4. 【POJ 1679】The Unique MST(次小生成树)

    找出最小生成树,同时用Max[i][j]记录i到j的唯一路径上最大边权.然后用不在最小生成树里的边i-j来替换,看看是否差值为0. #include <algorithm> #includ ...

  5. 【转】在mac上配置安卓SDK

    众所周知的原因,google的很多网站在国内无法访问,苦逼了一堆天朝程序员,下是在mac本上折腾android 开发环境的过程: 一.先下载android sdk for mac 给二个靠谱的网址: ...

  6. Struts中Action三种接收参数的方式?

    前言: 前面已经有一篇随笔介绍了Struts2的大概原理.本文就Struts2中Action与jsp页面进行数据对接时介绍几种常见方法! 值栈ValueStack 3个Action Action1 p ...

  7. Kudu 实时的存储系统

  8. BZOJ 2648: SJY摆棋子

    2648: SJY摆棋子 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 2968  Solved: 1011[Submit][Status][Disc ...

  9. eclipse中项目右上方有一个s,eclipse中项目左下方友谊个红色的叉,eclipse中项目左下方友谊个红色的感叹号

    S,这个猜测使用了Spring tools 然后可以方便的建立xml配置文件,然后平时不用在意 红的叉,这个可能是tomcat没有的不合适,可以在properties里面的找到runtime然后改成合 ...

  10. 【bzoj2006】 NOI2010—超级钢琴

    http://www.lydsy.com/JudgeOnline/problem.php?id=2006 (题目链接) 题意 给出一个数列,在其中选出K个长度在${[L,R]}$之间的不同的区间,使得 ...