linux centos7 sshd安装

linux centos7 sshd安装


通过ssh 22端口远程连接

  1. yum list installed | grep openssh-server 命令检查ssh安装有没有安装,如果查询出来有就表示安装了,否则反之
    检查ssh能不能用)
  2. 通过 yum install openssh-server 命令来安装
  3. 找到 /etc/ssh/ 目录下的服务配置文件 sshd_config,用vi sshd_config 打开该文件,将文件中的监听端口,监听地址、开启远程登陆和密码登陆 前的 #号去掉,如下图,保存退出

    在这里插入图片描述
  4. 输入systemctl start sshd.service 开启sshd服务
    在这里插入图片描述
  5. 检查sshd 服务是否启动,输入 ps -e | grep sshd或者netstat -an | grep 22,如下图
    在这里插入图片描述
Linux CentOS 7内网穿透是指通过某种方式,使得在内网中的Linux主机可以被外网访问。其中一种实现方式是使用SSH隧道。首先,你需要修改SSH配置文件来允许远程访问和保持连接活动。你可以使用以下命令来修改配置文件: 1. 使用命令`sed -i s/"#GatewayPorts no"/“GatewayPorts yes”/g /etc/ssh/sshd_config`将配置文件`/etc/ssh/sshd_config`中的`#GatewayPorts no`行改为`GatewayPorts yes`。 2. 使用命令`sed -i s/"#ClientAliveInterval 0"/“ClientAliveInterval 60”/g /etc/ssh/sshd_config`将配置文件`/etc/ssh/sshd_config`中的`#ClientAliveInterval 0`行改为`ClientAliveInterval 60`。这将确保SSH连接保持活动状态。 接下来,你可以使用SSH隧道将本地的端口映射到远程服务器的端口,从而实现内网穿透。例如,使用以下命令将本地的22端口发送到远程服务器的1688端口: 3. 运行命令`ssh -p22 -fNR 1688:localhost:22 root@39.106.106.136`,将本地的22端口映射到远程服务器的1688端口。这将允许你通过远程服务器的1688端口访问本地的22端口。 这样,你就可以通过远程服务器的1688端口来访问内网中的Linux CentOS 7主机了。请注意,这只是一种实现内网穿透的方式,还有其他的方法可以实现类似的功能。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [centos7 内网穿透教程](https://blog.csdn.net/weixin_42786042/article/details/115663614)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值