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

排查sshfs挂载失败的问题

#排查sshfs挂载失败的问题

写代码在Linux上运行,但是熟悉的IDE(比如VS code)在自己的电脑上,可以使用sshfs把linux上的目录挂载到本地,再用VScode打开即可,可以使用下面的命令:

sshfs -odebug,sshfs_debug,loglevel=debug  -o rw,allow_other,uid=1190,gid=1190,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/Users/harlanc/.privateKey harlanc@192.168.23.2:/data1/workspace/mount/ffmpeg /Users/harlanc/workspace_ffmpeg

但是今天碰到一个问题,在别的CentOS机器上没问题,但是到192.168.23.2这台机器却连不上,报如下错误:

SSHFS version 2.5
FUSE library version: 2.9.9
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-ologlevel=debug> <-oServerAliveInterval=15> <-oServerAliveCountMax=3> <-oIdentityFile=/Users/    harlanc/.privateKey> <-2> <harlanc@192.168.23.2> <-s> <sftp>
debug1: Reading configuration data /Users/harlanc/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to 192.168.23.2 [192.168.23.2] port 22.
debug1: Connection established.
debug1: identity file /Users/harlanc/.privateKey type -1
debug1: identity file /Users/harlanc/.privateKey-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.8
kex_exchange_identification: read: Connection reset by peer
Connection reset by 192.168.23.2 port 22
remote host has disconnected

服务端主动断开链接了,查看服务端的ssh服务:

[root@harlanc]# netstat -nltp | grep sshd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1085/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1085/sshd

在查看一下ssh进程的具体信息:

[root@ harlanc]# ps -ef | grep 1085
root        1085       1  0 15:39 ?        00:00:00 /usr/local/sbin/sshd -D[root@ harlanc]# rpm -qf /usr/local/sbin/sshd
***openssh-6.7.x86_64 //这里***是我们公司的名字

原来用的是我们公司自己的ssh服务。

而在可以连上的CentOS机器上,使用的是openssh这个开源ssh服务,把我们的服务替换成openssh不太现实,可以把openssh服务换一个端口启动起来:

 vim /etc/ssh/sshd_config

找到

 Port 22 

替换成

 Port 23

把openssh启动起来:

[root@ harlanc]# systemctl start sshd

这下两个服务都起来了:

[root@ harlanc]#  netstat -nltp | grep sshd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1085/sshd
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN      316299/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1085/sshd
tcp6       0      0 :::23                   :::*                    LISTEN      316299/sshd

使用sshfs挂载的时候指定一下端口:

 sshfs -p 23 -odebug,sshfs_debug,loglevel=debug  -o rw,allow_other,uid=1190,gid=1190,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/Users/harlanc/.privateKey harlanc@192.168.23.2:/data1/workspace/mount/ffmpeg /Users/harlanc/workspace_ffmpeg

最后终于挂载上了。

 harlanc@APB ~ % df -h
Filesystem                                                        Size    Used   Avail Capacity iused ifree %iused  
harlanc@192.168.23.2:/data1/workspace/mount/ffmpeg   295Gi   237Gi    58Gi    81%    1.4M   18M    7%   /Users/harlanc/workspace_ffmpeg
http://www.lryc.cn/news/462357.html

相关文章:

  • 【002】基于Spring Boot+Unipp的古诗词学习小程序【原创】
  • PageHelper循环依赖问题
  • k8s部署Kafka集群超详细讲解
  • 【数据采集工具】Sqoop从入门到面试学习总结
  • Matlab绘图总结(进阶)
  • QExcel 保存数据 (QtXlsxWriter库 编译)
  • k8s ETCD数据备份与恢复
  • 【C语言】循环嵌套:乘法表
  • 基于Java微信小程序的水果销售系统详细设计和实现(源码+lw+部署文档+讲解等)
  • 从0开始深度学习(11)——多层感知机
  • SQL语句查询
  • OSI参考模型与TCP/IP模型
  • 深度学习-26-基于PyTorch的多层感知机DNN
  • 华为杯”第十三届中国研究生数学建模竞赛-B题:具有遗传性疾病和性状的遗传位点分析(附MATLAB代码实现)
  • 滚雪球学Redis[8.2讲]:Redis的未来发展趋势:从云服务到AI与物联网的前沿探索
  • 针对考研的C语言学习(二叉树专题层次遍历---广度优先遍历)
  • spring揭秘31-spring任务调度01-spring集成Quartz及JDKTimer定时器
  • Kafka之资源容量评估
  • 深度学习神经网络的7大分类
  • 【DNF mysql8.0安装】DNF安装MySQL服务器教程
  • 决策树与随机森林在分类问题中的应用
  • Dmitri Shuralyov的全职开源之旅
  • 基于LSTM-Transformer混合模型实现股票价格多变量时序预测(PyTorch版)
  • 创建TaskPool任务组
  • 一文1800字从0到1浅谈web性能测试!
  • 计算机网络基础(1)
  • GNU/Linux - 宏处理工具M4
  • Oracle权限安全管理
  • C++笔记之静态多态和动态多态
  • Axure RP电商系统商城PC+app+后台买家卖端高保真原型模板及元件库