Skip to content

AppleScript: received "remote host has disconnected" while mounting remote drive with SSHFS #15

@latindancer

Description

@latindancer

Hi,
First of all let me say that I have read a lot of articles online (including the ones already published in github.com) before deciding to post this article here.

My machine

  • OS: Mac OS X 10.13.6
  • FUSE for Mac: 3.8.3
  • SSHFS: v2.5.0
  • IP address: 192.168.1.10/24

Remote server

  • Distributor ID: Ubuntu
  • Description: Ubuntu 16.04.6 LTS (server)
  • Release: 16.04
  • Codename: xenial
  • IP address: 192.168.1.30/24

Issue

  • From the above you can see that both computers are within the same LAN in the office
  • When I use the OS X terminal command below to mount the root folder of my remote server into my machine, there's no problem at all:
    sshfs -o allow_other,defer_permissions root@192.168.1.30:/ /Volumes/DATA/remotesrv

but

  • If I execute the AppleScript below:
-- Set remote user
set remoteUser to "root" as string

-- Set remote address (either IPv4 or URL)
set remoteAddress to "192.168.1.30" as string

-- Set local path of remote folder
set remotePath to "/" as string

-- Set path of local folder where to mount remote folder
set localMountPoint to "/Volumes/DATA/remotesrv" as string

-- Set full path of SSHFS application
set SSHFSApplicationPath to "/usr/local/bin/sshfs" as string

-- Set options
set sshfsOptions to "-o allow_other,defer_permissions"

-- Set command to execute
set myCommand to SSHFSApplicationPath & " " & sshfsOptions & " " & remoteUser & "@" & remoteAddress & ":" & remotePath & " " & localMountPoint

-- Set the password of the root user
set thePassword to "MYPASSWORD" as string

tell application "Finder"
	
	-- Mount remote folder via SSH
	do shell script myCommand password thePassword with administrator privileges
	
end tell

I received the following error message:

screenshot

Note: I've also tried by simply creating a bin/bash script as well as an Automator script/app but still the same issue.

If I execute the command from the terminal everything is ok but if I try to make it automatic, no chance at all.

BTW I've also tried the AppleScript from this link (obviously customized for my environment) but curiously I get exactly the very same error message.

This is driving me crazy.

Can someone help me?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions