当前位置: 首页 > news >正文

ssh 使用问题汇总

本文深入探讨SSH连接失败、密钥管理、权限设置等常见难题并提供详细的解决方案。通过本文您将能够轻松应对SSH使用过程中遇到的各类问题提升SSH操作效率保障远程连接的安全性。1. Connection reset by peer现象ssh到server时报如下错误ssh_exchange_identification: read: Connection reset by peer解决方法方法一在sever端修改白名单vim /etc/hosts.allow添加sshd : ALL重启ssh服务service sshd restart方法二在sever端修改黑名单vim /etc/hosts.deny把中含客户端IP的删除掉试试重启ssh服务service sshd restart2. connection refused现象ssh: connect to host XX.XX.XX.XX port 22: Connection refused解决方法方法一检查目标主机的ssh server端程序是否安装、服务是否启动是否在侦听22端口ps -ef|grep sshdroot 2859 1 020:29 ? 00:00:00 /usr/sbin/sshd -D root 2901 2859 020:31 ? 00:00:00 sshd: june[priv] june 2971 2901 020:31 ? 00:00:00 sshd:junepts/1其中/usr/sbin/sshd为ssh clinet/server中server端的守护进程如果上述结果中没有sshd出现那么可能就是你的server端程序没有安装或者sshd服务没有启动方法二本机是否设置了iptables规则禁止了ssh的连入/连出sudo iptables -LChain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp – anywhere anywhere tcp dpt:ssh Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination3. SSL_ERROR_SYSCALL现象SSL_connect: SSL_ERROR_SYSCALL in connectiontogithub.com:443原因分析一般因为开了代理解决方法git config --global --unset http.proxy4. Permission denied (publickey)原因本地禁止免密登录sudo vim /etc/ssh/sshd_config找到PasswordAuthentication将PasswordAuthentication no改为yes保存接着使用命令sudo service ssh restart原因远端安全限制The following method might work if you can access machineA and machineB independently (e.g. from machineC).If ssh-copy-id is not working, password authentication could be disabled.The following is a workaround.Having machineAs public key in machineBs authorized keys (i.e. ~/.ssh/authorized_keys) will allow you to ssh from machineA. This also applies to scp.After generating the key pairs using:ssh-keygenOnmachineA, executecat ~/.ssh/id_rsa.pubSample output:ssh-rsa AAAAB3NzaSGMFZW7yB anaskmahineACopy the printed key (⌘ CommandC, or CRTLC) then add it to the ~/.ssh/authorized_keys file onmachineB.For example, execute the following onmachineB:echo ssh-rsa AAAAB3NzaSGMFZW7yB anaskmahineA ~/.ssh/authorized_keys参考文献SSH登录提示:connection refused的解决办法_ABC_ORANGE的博客-CSDN博客教你如何调试 SSH 连接使用ssh远程连接服务器Permission denied (publickey). 解决方法_ssh publickey denied_IT鹅的博客-CSDN博客server - SSH Permission denied (publickey) - Ask Ubuntu
http://www.rkmt.cn/news/1297605.html

相关文章:

  • Git Commit Message 规范
  • 如何快速配置英雄联盟自动化工具:5个高效技巧指南
  • Reset-Windows-Update-Tool架构解析:Windows更新故障的深度修复方案
  • XCA证书管理器插件开发指南:如何扩展自定义证书功能
  • ME6206A 系列低压差线性稳压器
  • Allegro Route Keepout 的隐藏玩法:别急着删,教你一键开启‘布线许可’模式
  • Rust异步任务取消机制:从协作式取消到结构化并发实践
  • 为什么你的low-poly图总缺“设计感”?权威解析3种典型失败案例——基于Adobe Color Lab 2024色彩熵值实测数据
  • OCaml 技术突破:从云端到太空,开启卫星安全通信新时代!
  • 别再只会用@PreAuthorize了!SpringSecurity权限控制的5种实战姿势与避坑指南
  • Vue-Admin-Box数据可视化终极指南:基于ECharts的图表组件最佳实践
  • 用HSPICE玩转CMOS反相器:手把手教你分析尺寸、延迟与功耗的权衡
  • StarRocks BE启动失败?别急着查网络,先看看你的CPU是不是AVX2指令集
  • 用CircuitPython与NeoPixel打造可编程3D打印霓虹灯牌
  • 从零部署到实战:run_dbCAN4工具链的完整配置与高效使用指南
  • 如何用Python在5分钟内自动解析简历关键信息?PyResParser终极指南
  • Android虚拟摄像头安全使用指南:合法用途与风险防范的7个要点
  • 从摄像头模组到算法:工程师视角下的Sensor Flicker消除实战(以50Hz环境为例)
  • 不只是连线:用立创EDA做PCB布局时,这7个工程师才知道的实用技巧
  • GPT4All-Chat终极指南:3个实用技巧解决模型下载失败与对话卡顿问题
  • Workerman-todpole 完整指南:HTML5+WebSocket+PHP 实时交互游戏开发
  • EventQL:专为事件溯源设计的类 SQL 查询语言,让事件存储易用又强大!
  • 为什么你的Midjourney胶片图总像数码后期?——从光子散射模型到显影时间算法的底层差异解析
  • Midjourney等距视角风格落地全栈手册(附NASA航天器建模级参数配置表)
  • 2026年南京AI搜索推广公司权威榜单 首选南京微尚信息技术有限公司 - 奔跑123
  • Vital合成器引擎揭秘:从波形生成到频谱处理的完整流程
  • 气象预测长期误差太难搞?ICML 2026 这项成果用“累积上下文”给出了最优解
  • 3步开启AI智囊团:让ChatALL帮你一键问遍所有大模型
  • 解决大文件压缩效率瓶颈的7-Zip-zstd深度指南
  • Linux系统下Vue开发环境搭建全攻略:从Node.js到Vite实战