ssh修改端口号

ssh  is the default protocol used to manage remote systems which are mainly Linux and Network Devices. As it is working over a network connection and uses TCP it has a default port number which is 22. In this tutorial, we will look at how to change the default port number from the client and server point of view.

ssh是用于管理主要是Linux和网络设备的远程系统的默认协议。 由于它通过网络连接工作并使用TCP,因此其默认端口号为22。在本教程中,我们将从客户端和服务器的角度研究如何更改默认端口号。

列出SSH服务器端口配置 (List SSH Server Port Configuration)

Linux ssh server configuration is stored in /etc/ssh folder with a name sshd_config .  This configuration file provides a lot of configuration parameters. We can print the current port configuration with the following command by grepping Port text.

Linux ssh服务器配置存储在名称为sshd_config /etc/ssh文件夹中。 该配置文件提供了许多配置参数。 我们可以通过以下命令打印当前端口的配置,即grepping Port文本。

$ cat /etc/ssh/sshd_config  | grep Port

更改SSH服务器端口配置 (Change SSH Server Port Configuration)

In order to change port configuration we just need to remove the # from begging of the configuration line with is listed in the previous step. So

为了更改端口配置,我们只需要从上一步中列出的配置行开头删除# 。 所以

#Port 22

will change to the below where number is the port number we want.

将更改为以下内容,其中number是我们想要的端口号。

Port 2222

and We need to restart the ssh service in order to affect changes.

并且我们需要重新启动ssh服务以影响更改。

$ sudo systemctl restart ssh

更改SSH客户端端口配置 (Change SSH Client Port Configuration)

Now we have changes ssh port of the server but how can we specify different port than 22 in ssh client. We use a Linux ssh client which uses port 22 as default. We will use -p option in order to specify the port number we want to connect. In this example, we will connect to the port number 2222.

现在我们更改了服务器的ssh端口,但是如何在ssh客户端中指定不同于22端口。 我们使用Linux ssh客户端,该客户端默认使用端口22。 我们将使用-p选项来指定我们要连接的端口号。 在此示例中,我们将连接到端口号2222

$ ssh -p 2222 192.168.1.1
.ucfd124abb76772bec1c9ceab4c7330b1 , .ucfd124abb76772bec1c9ceab4c7330b1 .postImageUrl , .ucfd124abb76772bec1c9ceab4c7330b1 .centered-text-area { min-height: 80px; position: relative; } .ucfd124abb76772bec1c9ceab4c7330b1 , .ucfd124abb76772bec1c9ceab4c7330b1:hover , .ucfd124abb76772bec1c9ceab4c7330b1:visited , .ucfd124abb76772bec1c9ceab4c7330b1:active { border:0!important; } .ucfd124abb76772bec1c9ceab4c7330b1 .clearfix:after { content: ""; display: table; clear: both; } .ucfd124abb76772bec1c9ceab4c7330b1 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .ucfd124abb76772bec1c9ceab4c7330b1:active , .ucfd124abb76772bec1c9ceab4c7330b1:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .ucfd124abb76772bec1c9ceab4c7330b1 .centered-text-area { width: 100%; position: relative; } .ucfd124abb76772bec1c9ceab4c7330b1 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .ucfd124abb76772bec1c9ceab4c7330b1 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .ucfd124abb76772bec1c9ceab4c7330b1 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .ucfd124abb76772bec1c9ceab4c7330b1:hover .ctaButton { background-color: #E67E22!important; } .ucfd124abb76772bec1c9ceab4c7330b1 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .ucfd124abb76772bec1c9ceab4c7330b1 .ucfd124abb76772bec1c9ceab4c7330b1-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .ucfd124abb76772bec1c9ceab4c7330b1:after { content: ""; display: block; clear: both; }

LEARN MORE  Linux SCP Command Usage With Examples

.ucfd124abb76772bec1c9ceab4c7330b1 , .ucfd124abb76772bec1c9ceab4c7330b1 .postImageUrl , .ucfd124abb76772bec1c9ceab4c7330b1 .centered-text-area { min-height: 80px; position: relative; } .ucfd124abb76772bec1c9ceab4c7330b1 , .ucfd124abb76772bec1c9ceab4c7330b1:hover , .ucfd124abb76772bec1c9ceab4c7330b1:visited , .ucfd124abb76772bec1c9ceab4c7330b1:active { border:0!important; } .ucfd124abb76772bec1c9ceab4c7330b1 .clearfix:after { content: ""; display: table; clear: both; } .ucfd124abb76772bec1c9ceab4c7330b1 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .ucfd124abb76772bec1c9ceab4c7330b1:active , .ucfd124abb76772bec1c9ceab4c7330b1:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .ucfd124abb76772bec1c9ceab4c7330b1 .centered-text-area { width: 100%; position: relative; } .ucfd124abb76772bec1c9ceab4c7330b1 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .ucfd124abb76772bec1c9ceab4c7330b1 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .ucfd124abb76772bec1c9ceab4c7330b1 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .ucfd124abb76772bec1c9ceab4c7330b1:hover .ctaButton { background-color: #E67E22!important; } .ucfd124abb76772bec1c9ceab4c7330b1 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .ucfd124abb76772bec1c9ceab4c7330b1 .ucfd124abb76772bec1c9ceab4c7330b1-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .ucfd124abb76772bec1c9ceab4c7330b1:after { content: ""; display: block; clear: both; }

通过示例了解更多Linux SCP命令用法

翻译自: https://www.poftut.com/how-to-find-and-change-ssh-port-number/

ssh修改端口号

ssh修改端口号_如何查找和更改SSH端口号?相关推荐

  1. 配置mysql数据库端口号_数据库配置时要注意端口号

    初学pdo,总是连接不上mysql数据库,并返回SQLSTATE[HY000] [1049] Unknown database 'test1'. 一开始在网上查了好多,还是找不出错在哪.后来自己分析了 ...

  2. linux下sqlserver端口号,登陆sqlserver及修改端口号 (转)

    在一台计算机上面同时安装两个sql server数据库实例,第一次安装默认为机器名,端口号为1433 1.如果不知道服务器名,却想登陆的话可以直接输入127.0.0.1登陆之后,在新建查询中输入:SE ...

  3. mysql数据库怎么查看端口号_怎么查看数据库端口号(mysql怎么查看端口号)

    怎么查看数据库端口号(mysql怎么查看端口号) 2020-05-08 11:20:02 共9个回答 如何查看自己数据库的端口号 navicat,找到服务器,右键->连接属性,就找到端口号了 如 ...

  4. b宝塔 centos端口更改_centos修改ssh默认端口号的方法示例

    linux 一:修改/etc/ssh/sshd_config配置文件(注意:这里是sshd_config,而不是ssh_config) 1:查看ssh的默认端口号 netstat -anp|grep ...

  5. 如何修改mysql占用的端口号_修改mysql端口号(mysql的端口号)

    修改mysql端口号(mysql的端口号) 2020-05-07 22:12:00 共10个回答 如何查看mysql默认端口号和修改端口号 登录mysql,使用命令showglobalvariable ...

  6. vue脚手架搭建配置试调地址和端口号_全栈的自我修养: 002使用@vue/cli进行vue环境搭建 (使用Vue,SpringBoot,Flask完成前后端分离)...

    全栈的自我修养: 使用@vue/cli进行vue.js环境搭建 Success, real success, is being willing to do the things that other ...

  7. Redis修改端口号后无法连接的问题

    将redis配置文件中的端口号6379修改为6380后,除下下图情况: 由图中可以看出,6380端口的redis服务已经启动,但是输入命令 ./redis-cli 连接客户端会报错 Could not ...

  8. Redis修改端口号和密码

    redis修改密码有两种方法 一.直接在redis-cli修改 首先登陆redis [在Redis的安装路径下双击redis-cli.bat] (无密码)-h 127.0.0.1 -p 6379 (已 ...

  9. vue的路由怎么换端口_vue.js如何更改默认端口号8080为指定端口的方法

    本文介绍了vue.js如何更改默认端口号8080为指定端口,分享给大家,希望此文章对各位有所帮助. 执行npm run dev实际是在调用根目录下的package.json 打开package.jso ...

  10. 查看ssh端口号_萌新云服务器折腾记-SSH配置

    很早以前就想买个服务器自己玩一下(虽然我啥也不会),但是阿里云昂贵的价格让我望而却步,这次双十一发现了一个大好机会,以超低价格买了一台1核2G的ECS(三年,超开心).买完以后进控制台一看,一脸懵,这 ...

最新文章

  1. 源码阅读:AFNetworking(十六)——UIWebView+AFNetworking
  2. 多地给毕业生发补贴!有的高达6000元/人
  3. yolov3-tf2 数据格式压缩
  4. 程序员职业发展路径图:从菜鸟工程师到高级架构师
  5. Pro*c使用指示变量来处理NULL列值
  6. MySQL系列--4.使用Python3访问数据库
  7. 设置mysql的schema_MySQL Performance-Schema(一) 配置篇
  8. mysql 游标循环_MySQL 游标 循环
  9. 数值分析常见基本算法及MATLAB代码总结
  10. 思科模拟器:路由器基本配置
  11. python 3 三元表达式(三目表达式)
  12. tensorboard--曲线图颜色深浅两条线
  13. 安庆集团-冲刺日志(第三天)
  14. 项目经理的能力模型和能力提升的方法
  15. 【Lighthouse教程】Win10远程连接同步代码
  16. win10网页找不到服务器dns,Win10系统下网页打不开提示无法解析服务器DNS如何解决...
  17. 腾讯企业邮箱登录,邮件撤回怎么用?
  18. UDT的连接建立和释放
  19. Java判断gps点是否在中国,如何判断一个指定的位置点坐标(GPS上的经纬度)是否落在一个多边形区域内?...
  20. STM32的串口通信UART/TTL

热门文章

  1. Git报错:Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch
  2. 再遇soundmix.dll,小试pe_xscan
  3. CI框架email类发送邮件失败无报错,开启debug模式的方法
  4. 数学建模练习-----基于无线通信基站的室内定位问题
  5. loading等待载入正在加载的动画GIF图片圆形图标
  6. SQL Server 2019 安装教程(详细免费,自定义安装)
  7. SQL Server安装失败,SQL Server卸载不干净
  8. 中国34个省级行政区2000年-2021年逐月1km植被指数NDVI栅格数据处理及下载
  9. Thinkphp6.0博客源码分享【Wofl-blog】
  10. 日期/时间控件DateTimePicker