centos 7.0 修改ssh默认连接22端口 和 添加防火墙firewalld 通过端口
首先 先做的就是 修改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 通过端口的更多相关文章
- CentOS 6.0修改ssh远程连接端口
转自:系统运维 » CentOS 6.0修改ssh远程连接端口 实现目的:把ssh默认远程连接端口修改为2222 方法如下: 1.编辑防火墙配置:vi /etc/sysconfig/iptables ...
- CentOS 7.0 更改SSH 远程连接 端口号
许多学习过redhat 7的同学们,在使用centos的时候总会遇到一些问题,因为centos在安装时会默认开启一些服务,今天我们就来更改下centos 7.0的SSH端口. 操作步骤: 远程登录到c ...
- centos 5.11修改ssh默认端口号
查看下服务器端口号范围: # sysctl -a|grep ip_local_port_range net.ipv4.ip_local_port_range = 32768 61000 新 ...
- RHEL7 修改SSH默认端口及修改SELinux运行状态
RHEL7安装后,默认开启SSH服务以便远程配置,但默认端口22并不安全,一般不建议使用默认端口,那就修改SSH默认端口.在sshd_config里面的修改RHEL7.0上修改和7.0以下类似,但要注 ...
- CentOS7修改SSH远程连接端口
CentOS7修改SSH远程连接端口
- Linux Centos 6.9中SSH默认端口修改的坑
关于Linux Centos6.5的SSH默认端口修改的博客有一大堆,我在这里就不啰嗦了,但是面对Centos 6.9,就会发现有一个巨坑: 修改iptables之后执行下面的命令后: # servi ...
- LINUX 修改SSH默认22端口的方法
首先修改配置文件 vi /etc/ssh/sshd_config 找到#Port 22一段,这里是标识默认使用22端口,修改为如下: Port 22 Port 50000 然后保存退出 执行/etc/ ...
- CentOs 6.5设置使用私钥登录关闭ssh的密码登录修改ssh默认端口
使用SecureCRT工具创建RSA公钥和私钥 [选项]=>[会话选项] 然后在弹出对话框中选择[公钥]然后点击[属性]: 在弹出窗口中选中[使用会话公钥设置],点击[创建身份文件]按钮: 然后 ...
- centos修改ssh默认端口号的方法
修改/etc/ssh/sshd_config配置文件(注意:这里是sshd_config,而不是ssh_config) vi /etc/ssh/sshd_config 在sshd_config文件中添 ...
随机推荐
- Mybatis 自动生成代码
准备条件: 将下面的文件放入同一目录下 操作步骤: 1/ 在 generatorConfig.xml 中配置相关的参数,与需要被自动生成的表 也可以 执行项目中的MybatisConfigAutoGe ...
- python安装失败0x80240017
安装KB2999226更新补丁后, 可以正常安装python3.5. 此更新包在vs2015的patch包里有.Microsoft下载中心也有,这里列出的适用于win7x86: Windows 7 更 ...
- 【HDU 2874】Connections between cities(LCA)
dfs找出所有节点所在树及到树根的距离及深度及父亲. i和j在一棵树上,则最短路为dis[i]+dis[j]-dis[LCA(i,j)]*2. #include <cstring> #in ...
- Code::Blocks的魅力
Code::Blocks是C/C++集成开发环境,就像Dev C++.Visual Studio. 一.码代码时的技巧 按住Ctrl滚动鼠标滚轮,改变字体大小. Ctrl+D可复制当前行或选中块. C ...
- yii2的扩展程序包
查找yii2的扩展程序包 https://packagist.org/ 搜索yiisoft/yii2 可通过composer install下载 composer install下载程序包是通过com ...
- C++强制类型转换操作符 dynamic_cast
dynamic_cast是四个强制类型转换操作符中最特殊的一个,它支持运行时识别指针或引用. >>>>>>>>>>>编译器的RTTI设 ...
- 转发:IT行业中的甲方乙方关系
原文:http://byteh.blog.51cto.com/141786/1004046/ 混IT,必须理解“甲方乙方” By 韩宇斌 2012-09-23 9月初,修改了QQ签名,把“甲方乙方”放 ...
- 浅析VO、DTO、DO、PO的概念、区别和用处
上一篇文章作为一个引子,说明了领域驱动设计的优势,从本篇文章开始,笔者将会结合自己的实际经验,谈及领域驱动设计的应用.本篇文章主要讨论一下我们经常会用到的一些对象:VO.DTO.DO和PO. 由于不同 ...
- text-indent无效解决方案
text-indent是用来字符缩进的. 1.text-indent所在的元素是行内元素而非块级元素.比如用在span,a等行内元素上.解决方案:在行内元素加上display:block; 或者把目标 ...
- VS2010 asp.net development server 无法展示svg图片
无解!只能使用IIS Express或者部署到服务器上的IIS能解决! 以下为解释: http://stackoverflow.com/questions/5981309/asp-net-develo ...