排查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

排查sshfs挂载失败的问题的更多相关文章

  1. nfs文件系统挂载失败解决方法

    nfs文件系统挂载失败解决方法 */--> nfs文件系统挂载失败解决方法 Table of Contents 1. 错误提示 2. 我的配置 1 错误提示 bootserver=255.255 ...

  2. windows通过sshfs挂载linux目录

    之前讲过一种方法,PC跟VM在同局域网的情况下,可以用samba的方式挂载linux系统的目录到windows上.但是当PC跟VM不同局域网时这种方式就没办法了. 网络环境 在示意图中,PC只能直连物 ...

  3. 使用sshfs挂载远程服务器目录

    点击访问原文 您还可以加入全栈技术交流群(QQ群号:254842154) 服务器日志查看,是开发人员和服务器运维人员在工作中经常会遇到的一件事情,只有一台服务器时,比较好办,直接登录服务器使用tail ...

  4. 使用 SSHFS 挂载远程的 Linux 文件系统及目录

    1. 安装 sudo apt-get install sshfs 2. 创建 SSHFS 挂载目录 sudo mkdir /mnt/cong 3.使用 SSHFS 挂载远程的文件系统 sudo ssh ...

  5. windows下sshfs挂载远程文件夹-server could not connect故障解决

    使用sshfs挂载server上面的文件夹到windows中.轻松方便. 在之前的系统上挂载.没出问题. 近期买了块固态硬盘.装了个系统. 结果在系统上执行sshfs时报例如以下错误: 事实上非常ea ...

  6. Linux安装sshfs挂载远程目录到本地及卸载

    挂载远程目录的方式很多,这里把sshfs记录一下备忘.Linux用sshfs挂载远程目录到本地 安装sshfs 在Ubuntu下,只需要使用 $ sudo apt-get install sshfs ...

  7. U盘安装Ubuntu Server CD-ROM挂载失败

    U盘安装 Ubuntu Server 发生Failed to copy file from CD-ROM问题 使用UltraISO制作Ubuntu Server安装盘,在安装过程中出现[!!] Loa ...

  8. Linux嵌入式学习-mount命令+nfs挂载失败原因【转】

    NFS 挂载失败原因[待搜集] 1.挂载时若出现mount.nfs: Input/output error 解决:在客户端也需启动portmap服务 service portmap status[查看 ...

  9. Ubuntu下使用sshfs挂载远程目录到本地(和Windows挂载盘一样)

    访问局域网中其他Ubuntu机器,在不同机器间跳来跳去,很是麻烦,如果能够把远程目录映射到本地无疑会大大方面使用,就像Windows下的网络映射盘一样.在Linux的世界无疑也会有这种机制和方式,最近 ...

  10. Linux使用sshfs挂载远程目录到本地

    1安装sshfs [root@iZwz9hy7gff0kpg1swp1d3Z ~]# yum install sshfs 2创建本地目录 [root@iZwz9hy7gff0kpg1swp1d3Z ~ ...

随机推荐

  1. 【Android】虚拟设备运行BUG

    虚拟设备是AndroidStudio提供的一个真机模拟运行环境 跑这个虚拟设备要下载手机系统镜像才能跑起来 然后项目中勾选这个虚拟设备,怎么设置就不赘述了 问题奇怪的是运行环境有了,App应用程序也能 ...

  2. 【Java-GUI】03 事件监听

    --1.监听机制案例 简答理解:操作驱动程序执行 完整的操作体系:事件源.事件.监听器.注册监听 案例: 点击OK按钮,让上方的输入框写入一段字符 package cn.dzz; import jav ...

  3. 【JDBC】Extra01 Oracle-JDBC

    关于驱动包依赖: 官网提供的地址: https://www.oracle.com/database/technologies/jdbc-drivers-12c-downloads.html Maven ...

  4. 如何在Windows10电脑上打开3D建模STL文件

    相关: https://www.bilibili.com/video/BV1gD4y1h7tj/

  5. 分布式深度学习计算框架依赖环境——NCCL的安装

    分布式深度学习计算框架(MindSpore, PyTorch)依赖环境--NCCL, NCCL提供多显卡之间直接进行数据交互的功能(可以跨主机进行). 注意: 本文环境为  Ubuntu18.04 以 ...

  6. 【转载】 从零开始编写一个简单的Linux文件系统

    版权声明:本文为CSDN博主「shuxiaogd」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net/shuxiao ...

  7. 清除 Nuxt 状态缓存:clearNuxtState

    title: 清除 Nuxt 状态缓存:clearNuxtState date: 2024/8/7 updated: 2024/8/7 author: cmdragon excerpt: 摘要:本文介 ...

  8. 海豚²来了丨DolphinDB 集成 DolphinScheduler,任务调度更轻松

    DolphinDB 是一款高性能时序数据库.DolphinDB 集成了功能强大的编程语言和高容量高速度的批流一体数据分析系统,为海量数据(特别是时间序列数据)的快速存储.检索.计算及分析提供一站式解决 ...

  9. AtCoder Beginner Contest 318

    AtCoder Beginner Contest 318 A - Full Moon (atcoder.jp) 以\(M\)为首项,\(P\)为公差,看\(1 \sim N\)里包含了多少项的个数 # ...

  10. ui选择

    MVC全名是Model View Controller,MVC开始是存在于桌面程序中的,M是指业务模型,V是指用户界面,C则是控制器,使用MVC的目的是将M和V的实现代码分离,从而使同一个程序可以使用 ...