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文件中添 ...
随机推荐
- 概率DP light oj 1030
t组数据 n块黄金 到这里就捡起来 出发点1 到n结束 点+位置>n 重掷一次 dp[i] 代表到这里的概率 dp[i]=(dp[i-1]+dp[i-2]... )/6 如果满6个的话 否则 ...
- 怎么给我的Office文档加密
很多的用户朋友都可以熟练的使用office中的Word.Excel和PowerPoint文档,但大家对Office文档加密方式了解的并不多.Advanced Office Password Recov ...
- Java字符串面试(二)
先看下面2个程序 public static void main(String[] args) { String a = "a1"; String b = "a" ...
- Linux上服务的启动,停止和重启
(1)查看所有的服务 [berry@berry:practice] service Usage: service < option > | --status-all | [ service ...
- asp.net mvc 设置启动页面在区域中
在开发过程中,我们有时候需要启动区域中的页面为起始页面,那我们就需要子啊路由中添加一段代码 如何完整案例: public static void RegisterRoutes(Rout ...
- 浅谈jQuery页面的滚动位置scrollTop、scrollLeft
Web页面常常比显示该页面的浏览器窗口还要大,因为Web文档具有很多内容,往往会导致页面比浏览器还要高,有时候甚至还要宽,这迫使访问者通过滚动来查看整个页面(如图10-8所示).当访问者滚动页面的时候 ...
- NPOI简介
NPOI 是 POI 项目的 .NET 版本.POI是一个开源的Java读写Excel.WORD等微软OLE2组件文档的项目. (一)传统操作Excel遇到的问题: 1.如果是.NET,需要在服务器端 ...
- 绘制图形与3D增强技巧(五)----多边形图元的使用及其他
1.注意多边形图元中的多边形只能是平面的,而且必须为凸多边形,且多边形的边不能弯曲 2.细分和边界,可以人为设置边界边和非边界边 glEdgeFlag(true)//接下来所有点均为边界边起点 glE ...
- Python % 格式化字符串
格式字符串 python 使用一个字符串作为模板 模板中含有格式符,为真实值预留位置 使用tuple或者字典来传递值 模板和值之间,用 % 来表示格式化操作 例子: 1) tuple 传值 print ...
- linux下进程权限分析
转自http://blog.chinaunix.net/uid-27105712-id-3349522.html 在linux下,关于文件权限,大部分人接触比较多,也比较熟悉了解.但是对进程权限一般知 ...