sshfs – autofs mounts all shares instead of only the accessed one

I set up autofs with sshfs to mount my shares when I access them. However, if I access one of them, all of them get mounted which I would like to avoid. Am I doing something wrong? Here’s my config

/etc/auto.master:

/media/sshfs /etc/auto.sshfs uid=1000,gid=1000,--timeout=0,--ghost

/etc/auto.sshfs:

pi2 -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs#pi2:
pi2_root -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs#pi2:/
pi2_hdd -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs#pi2:/media/hdd/

To avoid HDD spin-ups I would like to not mount the HDD if I only access the home directory.

How to specify SSHFS capacity

Is there anyway to set SSHFS volume size with option cmd’s?

I already tried to find option cmd’s in https://linux.die.net/man/1/sshfs but it seems that there are no settings for that.

But some SFTP clients have quota function to set virtual volume size. How do they make it?

wsl2 – Windows shortcut to map disk with sshfs

I don’t want to permanently map remote disks from production systems, I want to click on shortcut to map the disk and than click another shortcut to unmap it. The sshfs works fine when used from Bash. However when I run the command from shortcut with wsl.exe, it maps the disk but as soon as the command ends, mapping is removed. This can be replicated by running wsl.exe from PS:

PS C:Usersuser> wsl.exe --user root -- sshfs -o allow_other,default_permissions,ro user@machine:/path /mnt/path `&`& read -p "Press enter to continue"

After the sshfs is executed, I can see that the disk is mapped but when I press enter, the disk is unmapped. It seems that there is some kind of “console session” and the mapping is related to the session only, once the session ends, the mapping ends.

I have no idea what’s going on, I am missing something simple but fundamental. Thank you for any pointers. And no, using bash.exe does not fix the problem.

linux – SSHFS Exit status 1

folks.

I’m trying to mount my remote drive via SSHFS. It was working yesterday and now it’s not working today. Any idea what’s going on? Tried searching for this but couldn’t find any answers.

~:$ sshfs 'user@<the domain>:/home/user' '/home/user/Remote/' -odebug,sshfs_debug,loglevel=debug

debug1: Offering public key: user@machine RSA SHA256:5I1utkxxxxxxxxxxxxx30 agent
debug1: Server accepts key: user@machine RSA SHA256:5xxxxxxxxxxxxxxxxx30 agent
debug1: Authentication succeeded (publickey).
Authenticated to <the domain> ((xx.xx.xx.xx):22).
debug1: channel 0: new (client-session)
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 3724, received 2736 bytes, in 1.6 seconds
Bytes per second: sent 2337.8, received 1717.6
debug1: Exit status 1
remote host has disconnected

Any help would be greatly appreciated

MacOS kernel panics when unmounting Time Machine disk images over SSHFS mount

I made a simple Bash script to back up my Mac through Time Machine over network. It mounts a server through SSHFS using MacFUSE, mounts a HFS+ sparsebundle disk image inside that mount, and tells Time Machine to back up to it, unmounting them when it’s done. It usually works just fine, but a kernel panic happens about once in every 6 or so times when it tries to unmount the sparsebundle disk image. The kernel panics seemed to happen both in MacOS Catalina and Big Sur. The same problem never changed even when I changed from a Macbook Air late 2015 to a 2020 MacBook Pro, so I believe the Mac hardware might be irrelevant.

Is there a way to tell if this is a problem relating to the Apple DiskImages driver, the MacFUSE kernel extension, or something different? Should I consult Apple or the maker of MacFUSE if there is no other way to correct this?

Here is the Kernel Panic backtrace:

panic(cpu 3 caller 0xffffff801ad85bc4): "wire_count == 0, m = 0xffffff8032fd02b0, obj = 0xffffff803d9b9d00n"@/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/xnu/xnu-7195.81.3/osfmk/vm/vm_pageout.c:7572
Backtrace (CPU 3), Frame : Return Address
0xffffffa090a739d0 : 0xffffff801acbab4d 
0xffffffa090a73a20 : 0xffffff801adfd7e3 
0xffffffa090a73a60 : 0xffffff801adede1a 
0xffffffa090a73ab0 : 0xffffff801ac5fa2f 
0xffffffa090a73ad0 : 0xffffff801acba3ed 
0xffffffa090a73bf0 : 0xffffff801acba6d8 
0xffffffa090a73c60 : 0xffffff801b4bef9a 
0xffffffa090a73cd0 : 0xffffff801ad85bc4 
0xffffffa090a73e20 : 0xffffff801b42ad4f 
0xffffffa090a73e70 : 0xffffff801d2969c1 
0xffffffa090a73e90 : 0xffffff801d2960aa 
0xffffffa090a73eb0 : 0xffffff801d296000 
0xffffffa090a73ed0 : 0xffffff801b3fc9f7 
0xffffffa090a73ef0 : 0xffffff801b3f9a7d 
0xffffffa090a73f30 : 0xffffff801b41691e 
0xffffffa090a73f70 : 0xffffff801b415f06 
0xffffffa090a73fa0 : 0xffffff801ac5f13e 
      Kernel Extensions in backtrace:
         com.apple.driver.DiskImages(493.0)(11E51AF9-6467-39AC-89A2-A62CE763F298)@0xffffff801d295000->0xffffff801d2a0fff
            dependency: com.apple.iokit.IOStorageFamily(2.1)(B5300908-BF34-3D47-8776-FB154A6DEE4C)@0xffffff801d73f000->0xffffff801d750fff

Process name corresponding to current thread: kernel_task
Boot args: -v chunklist-security-epoch=0 -chunklist-no-rev2-dev

Mac OS version:
20D74

Kernel version:
Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64
Kernel UUID: C86236B2-4976-3542-80CA-74A6B8B4BA03
KernelCache slide: 0x000000001aa00000
KernelCache base:  0xffffff801ac00000
Kernel slide:      0x000000001aa10000
Kernel text base:  0xffffff801ac10000
__HIB  text base: 0xffffff801ab00000
System model name: MacBookPro16,3 (Mac-E7203C0F68AA0004)
System shutdown begun: NO
Hibernation exit count: 0

System uptime in nanoseconds: 11092066957957
Last Sleep:           absolute           base_tsc          base_nano
  Uptime  : 0x00000a1692b5fd2e
  Sleep   : 0x00000877d70daad5 0x00000bfb283e2420 0x000008693a36c209
  Wake    : 0x00000877e168dd7b 0x00000c4e1fdaf8c6 0x00000877e012bf29
last started kext at 11091852477214: >!AXsanScheme  3 (addr 0xffffff801c467000, size 12288)
last stopped kext at 10623433685325: >!AXsanScheme  3 (addr 0xffffff801c467000, size 12288)
loaded kexts:
io.macfuse.filesystems.macfuse  2053.20
org.virtualbox.kext.VBoxNetAdp  6.1.18
org.virtualbox.kext.VBoxNetFlt  6.1.18
org.virtualbox.kext.VBoxUSB 6.1.18
org.virtualbox.kext.VBoxDrv 6.1.18
>AGPM   119
>!APlatformEnabler  2.7.0d0
>X86PlatformShim    1.0.0
@filesystems.autofs 3.0
@fileutil   20.036.15
>!ATopCaseHIDEventDriver    4030.5
>!AHIDALSService    1
>!AGraphicsDevicePolicy 6.2.2
>!AUpstreamUserClient   3.6.8
@AGDCPluginDisplayMetrics   6.2.2
>pmtelemetry    1
>!A!IKBLGraphics    16.0.1
>LuaHardwareAccess  1.0.16
|IOUserEthernet 1.0.1
|IO!BSerialManager  8.0.3d9
@Dont_Steal_Mac_OS_X    7.0.0
>!AHV   1
>!ADiskImages2  1
>!A!ISlowAdaptiveClocking   4.0.0
>!ABridgeAudio!C    100.2
>!A!ICFLGraphicsFramebuffer 16.0.1
>!A!IPCHPMC 2.0.1
>BridgeAudioCommunication   100.2
>!AAVEBridge    6.1
>!ABacklight    180.3
>!AThunderboltIP    4.0.3
>!AGFXHDA   100.1.431
>!AMCCSControl  1.14
@filesystems.apfs   1677.81.1
>BCMWLANFirmware4378.Hashstore  1
>BCMWLANFirmware4377.Hashstore  1
>BCMWLANFirmware4364.Hashstore  1
>BCMWLANFirmware4355.Hashstore  1
>!A!BModule 1
@filesystems.tmpfs  1
@filesystems.hfs.kext   556.60.1
@BootCache  40
@!AFSCompression.!AFSCompressionTypeZlib    1.0.0
@!AFSCompression.!AFSCompressionTypeDataless    1.0.0d1
@private.KextAudit  1.0
>!ASmartBatteryManager  161.0.0
>!ABCMWLANBusInterfacePCIeMac   1
>!AACPIButtons  6.1
>!ASMBIOS   2.1
>!AACPIEC   6.1
>!AAPIC 1.7
@!ASystemPolicy 2.0.0
@nke.applicationfirewall    310
|IOKitRegistryCompatibility 1
|EndpointSecurity   1
>!AXsanScheme   3
|IOUSBUserClient    900.4.2
@kext.triggers  1.0
>!AHIDKeyboard  223
>!AActuatorDriver   4400.28
>!AMultitouchDriver 4400.28
>!AInputDeviceSupport   4400.35
>!AHS!BDriver   4030.5
>IO!BHIDDriver  8.0.3d9
>!AGraphicsControl  6.2.2
|IOAVB!F    930.1
>X86PlatformPlugin  1.0.0
@!AGPUWrangler  6.2.2
|IOSlowAdaptiveClocking!F   1.0.0
|IOAccelerator!F2   439.52
>!A!ILpssUARTv1 3.0.60
>!A!ILpssUARTCommon 3.0.60
>!AOnboardSerial    1.0
>IOPlatformPlugin!F 6.0.0d8
@!AGraphicsDeviceControl    6.2.2
>!ABacklightExpert  1.1.0
|IONDRVSupport  585
|IOAudio!F  300.6.1
@vecLib.kext    1.2.0
|IOGraphics!F   585
>!ASMBus!C  1.0.18d1
@plugin.IOgPTPPlugin    900.11
|IOEthernetAVB!C    1.1.0
>usb.cdc.ncm    5.0.0
>usb.cdc    5.0.0
>usb.networking 5.0.0
>usb.!UHostCompositeDevice  1.2
>!AThunderboltPCIDownAdapter    4.1.1
>!AThunderboltDPInAdapter   8.1.4
>!AThunderboltDPAdapter!F   8.1.4
>!AHPM  3.4.4
>!A!ILpssI2C!C  3.0.60
>!A!ILpssDmac   3.0.60
>usb.!UVHCIBCE  1.2
>usb.!UVHCICommonBCE    1.0
>usb.!UVHCI 1.2
>usb.!UVHCICommon   1.0
>!AEffaceableNOR    1.0
|IOBufferCopy!C 1.1.0
|IOBufferCopyEngine!F   1
|IONVMe!F   2.1.0
>!AThunderboltNHI   7.2.8
|IOThunderbolt!F    9.3.2
>IO!BHost!CPCIeTransport    8.0.3d9
|IO!BHost!CTransport    8.0.3d9
>!AConvergedIPCOLYBTControl 1
>!A!BDebug  1
>!A!BDebugService   1
>!AConvergedPCI 1
>!A!ILpssI2C    3.0.60
>usb.!UXHCIPCI  1.2
>usb.!UXHCI 1.2
>!ABSDKextStarter   3
|IOSurface  289.3
@filesystems.hfs.encodings.kext 1
|IOUSB!F    900.4.2
>!AEFINVRAM 2.1
>!AMultiFunctionManagerMac  1
>!AEFIRuntime   2.1
>!ABCMWLANCoreMac   1.0.0
|IOSerial!F 11
|IO80211!FV2    1200.12.2b1
|IOSkywalk!F    1
>mDNSOffloadUserClient  1.0.1b8
>IOImageLoader  1.0.0
>corecapture    1.0.4
>!ASMCRTC   1.0
|IOSMBus!F  1.1
|IOHID!F    2.0.0
$!AImage4   3.0.0
|IOTimeSync!F   900.11
|IONetworking!F 3.4
>DiskImages 493.0.0
|IO!B!F 8.0.3d9
|IOReport!F 47
|IO!BPacketLogger   8.0.3d9
$quarantine 4
$sandbox    300.0
@kext.!AMatch   1.0.0d1
|CoreAnalytics!F    1
>!ASSE  1.0
>!AKeyStore 2
>!UTDM  511.60.2
|IOUSBMass!SDriver  184.40.6
|IOSCSIBlockCommandsDevice  436.40.6
|IO!S!F 2.1
|IOSCSIArchitectureModel!F  436.40.6
>!AMobileFileIntegrity  1.0.5
@kext.CoreTrust 1
>!AFDEKeyStore  28.30
>!AEffaceable!S 1.0
>!ACredentialManager    1.0
>KernelRelayHost    1
|IOUSBHost!F    1.2
>!UHostMergeProperties  1.2
>usb.!UCommon   1.0
>!ABusPower!C   1.0
>!ASEPManager   1.0.1
>IOSlaveProcessor   1
>!AACPIPlatform 6.1
>!ASMC  3.1.9
|IOPCI!F    2.9
|IOACPI!F   1.4
>watchdog   1
@kec.pthread    1
@kec.corecrypto 11.1
@kec.Libm   1

autofs is not mounting sshfs point while sshfs and mount -t fuse does

folks.
Recently I came over autofs and now trying to make my everyday life easier. I have a remote server that I use as I file share with a help of sshfs for years. So, I found some tutorials how to automate sshfs with a help of autofs. Here are my configs:

auto.master:

/home/user/autofs/ /etc/autofs/auto.sshfs uid=1000,gid=1000,--timeout=300,--ghost

auto.sshfs:

cux -fstype=fuse,port=222,rw,nodev,noatime,allow_other,IdentityFile=/home/user/.ssh/id_rsa :sshfs#user@server.com:/path/to/files

The remote server accepts only ssh keys, so the user who is trying to access the mount point has an ssh-agent running with keys imported.

But when I’m trying to access the mount point I get:

Dec 31 18:56:37 ice automount(25565): mount(generic): calling mount -t fuse -o uid=1000,gid=1000,port=222,rw,nodev,noatime,allow_other,IdentityFile=/home/user/.ssh/id_rsa sshfs#user@server.com:/path/to/files /home/user/autofs/cux
Dec 31 18:56:37 ice automount(25565): spawn_mount: mtab link detected, passing -n to mount
Dec 31 18:56:37 ice automount(25565): >> read: Connection reset by peer
Dec 31 18:56:37 ice automount(25565): mount(generic): failed to mount sshfs#user@server.com:/path/to/files (type fuse) on /home/user/autofs/cux
Dec 31 18:56:37 ice automount(25565): dev_ioctl_send_fail: token = 67
Dec 31 18:56:37 ice automount(25565): failed to mount /home/user/autofs/cux

But if I mount with sshfs (from my user):

sshfs -p 222 server.com:/path/to/files /home/user/remote/cux -o reconnect

It succeeds. Even if I use exactly the same command as autofs run from root as autofs does:

mount -t fuse -o uid=1000,gid=1000,port=222,rw,nodev,noatime,allow_other,IdentityFile=/home/user/.ssh/id_rsa sshfs#user@server.com:/path/to/files /home/user/autofs/cux

It succeeds as well.
But it looks like the problem is the ssh keys. If I run the mount command from root having no user keys imported (su -), the password will be prompted.
Is there is a way to get around this problem and make autofs use ssh keys of the user who is accessing the mountpoint?

ssh – Cannot sshfs to server over proxycommand on Windows

I’m trying to connect through sshfs-win to mount a drive over a jumphost.
I can normally connect through ssh but when invoked over sshfs-win it fails.

Also, I can normally mount the jumphost, but not the internal server drive.

PS C:Program FilesSSHFS-Winbin> .sshfs-win.exe cmd krakenss2:/ Y: -odebug -ologlevel=debug3
SSHFS version 3.5.2
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-ologlevel=debug3> <-2> <krakenss2> <-s> <sftp>
debug1: Reading configuration data /cygdrive/c/Users/qqqq/.ssh/config
debug1: /cygdrive/c/Users/qqqq/.ssh/config line 29: Applying options for krakenss2
debug1: Executing proxy command: exec "ssh -W int-dev.node:22 jumphost.com -l qqqq -p443"
debug1: identity file C:\Users\qqqq\.ssh\key type 0
debug1: identity file C:\Users\qqqq\.ssh\key-cert type -1
/bin/shdebug1: Local version string SSH-2.0-OpenSSH_8.3
: No such file or directory
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
read: Connection reset by peer
PS C:Program FilesSSHFS-Winbin>

But connecting to the jumphost is ok. I sense the problem is when executing the proxyjump command.

PS C:Program FilesSSHFS-Winbin> .sshfs-win.exe cmd jump:/ Y: -odebug -ologlevel=debug3
SSHFS version 3.5.2
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-ologlevel=debug3> <-2> <jump> <-s> <sftp>
debug1: Reading configuration data /cygdrive/c/Users/qqqq/.ssh/config
debug1: /cygdrive/c/Users/qqqq/.ssh/config line 1: Applying options for jump
debug2: resolving "jumphost.com" port 443
debug2: ssh_connect_direct
debug1: Connecting to jumphost.com [53] port 443.
debug1: Connection established.
debug1: identity file C:\Users\qqqq\.ssh\key type 0
debug1: identity file C:\Users\qqqq\.ssh\key-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to jumphost.com:443 as 'qqq'
debug3: put_host_port: [jumphost.com]:443
debug3: hostkeys_foreach: reading file "/cygdrive/c/Users/qqqq/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /cygdrive/c/Users/qqqq/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from [jumphost.com]:443
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521

mount – sudo rm -rf ed a ghost sshfs folder. Testdisk’ed it. Then unplugged usb disk without unmounting hoping that disk uses backup gpt next time mounting

There was an OSX vm running on linux. We wanted to mount an external usb disk into OSX. I mounted disk on linux it gave non clean eject errors on windows.

First I mounted it on linux. Then installed brew and cask osxfuse and sshfs on OSX. Then I mounted it using sshfs however disk was in russian and it saw nothing, folder seemed to be empty. Then I tried to unmount folder named “sshfspoint” it gave error something like “not mounted” and wanted to remount using sshfs gave error again and decided to remove the folder. However I realized after 4 seconds I was inside it, and it started to delete files. Then I ran testdisk on linux and saw bunch of files on recycle bin dated 2018. I could not figure out it was the deletion date or file date.

Page downed hundreds of pages (all bitmap,png etc picture files) and decided to unplug the disk without unmounting on linux or OSX. Because many times I did that file system (FAT or otherwise) was not updated, instead used backup GPT on next mount and what I was deleted or written were completely ignored by disks file system. I wanted to exploit this empiric knowledge to get out of this situation.

So, What should I expect and how can I make sure If I have deleted something recently or what I have deleted using “sudo rm -rf” … ?