首先 先做的就是 修改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. asp.net mvc 依赖缓存启动项配置

    msdn 参考地址:https://msdn.microsoft.com/zh-cn/library/ms229862 4.5 第一步:32bit%windir%\Microsoft.NET\Fram ...

  2. 操作系统也谈"算法"

    前言: 近来在准备校招的笔试面试,复习到操作系统时感觉概念性的东西比较多,不过对于以下的几类算法还是有必要做个小小总结. [作业调度算法] 先来先服务(FCFS, First Come First S ...

  3. css-使用line-height实现垂直居中的一些问题

    网上都是这么说的,把line-height值设置为height一样大小的值可以实现单行文字的垂直居中.这句话确实是正确的,但其实也是有问题的.问题在于height,看我的表述:"把line- ...

  4. Top K 问题

    Example Given [3,10,1000,-99,4,100] and k = 3. Return [1000, 100, 10]. 解法有以下几种: 1. bubble sort k tim ...

  5. 【faster-rcnn】训练自己的数据集时的坑

    既然faster-rcnn原版发表时候是matlab版代码,那就用matlab版代码吧!不过遇到的坑挺多的,不知道python版会不会好一点. ======= update ========= 总体上 ...

  6. 说说markdown和latex的简单比较

    latex是纯学术风格,写paper写书用 markdown是程序员风格,写笔记贴代码片段用 简单说,latex适合长篇.精致,比如数学公式.图片位置调整.表格样式调整.而markdown就是粗线条, ...

  7. 【BZOJ-2438】杀人游戏 Tarjan + 缩点 + 概率

    2438: [中山市选2011]杀人游戏 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1638  Solved: 433[Submit][Statu ...

  8. 【BZOJ-3696】化合物 树形DP + 母函数(什么鬼)

    3696: 化合物 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 165  Solved: 85[Submit][Status][Discuss] D ...

  9. asp.net下webform的ReadOnly和Enabled属性最终渲染的结果

    ReadOnly对应readonly="readonly" Enabled对应disabled="disabled" 然后研究了一下这两种的用法,特此标记一下: ...

  10. 数据结构算法C语言实现(十一)--- 3.4队列的链式表示和实现

    一.简介 FIFO. 二.头文件 //3_4_part1.h /** author:zhaoyu email:zhaoyu1995.com@gmail.com date:2016-6-9 note:r ...