Mount filesystem over sshfs at system startup / boot Mojave 10.14.6

Hello


I have an account at rsync.net

I have now mounted this filesystem using sshfs. The rsync.net account now show in the finder, and I am able to drag and drop using finder.


Mojave 10.14.6


Now, I want mount the rsync.net filesystem over sshfs at boot / system startup. How can this be done ?

Below is some output of various commands, for a better understanding of the system.


Tormods-MacBook-Pro:~ tormod$ sshfs --version

SSHFS version 2.5 (OSXFUSE SSHFS 2.5.0)

OSXFUSE 3.10.3

FUSE library version: 2.9.7

fuse: no mount point

Tormods-MacBook-Pro:~ tormod$


Tormods-MacBook-Pro:~ tormod$ kextstat|grep fuse

185 0 0xffffff7f85a93000 0x19000 0x19000 com.github.osxfuse.filesystems.osxfuse (3.10.3) AF3874A9-CF4E-39BF-A807-F61D1E6FABBF <8 6 5 3 1>

Tormods-MacBook-Pro:~ tormod$


Posted on Aug 23, 2020 3:31 AM

Reply

Similar questions

20 replies

Sep 25, 2020 3:57 AM in response to tormod_bjorøy

Now, everything works when I have SIP disabled.

The sshfs connection to rsync.net is up, an is connected at boot / startup.


The setting I used for the mount point:

/mnt/sshfs


This was needed in order for automount and the mounting at boot to be able to work together.


New contents of the "/etc/auto_master"

#
# Automounter master map
#
+auto_master       # Use directory service
/net               -hosts       -nobrowse,hidefromfinder,nosuid
/home              auto_home    -nobrowse,hidefromfinder
/Network/Servers   -fstab
/-                 -static
/mnt/sshfs         auto_sshfs   -nobrowse,nosuid


In finder the disk, or the remote sshfs connection is called rsync_net, because of the

volname=rsync_net

setting for the sshfs connection.


So, now everything is good until I turn on the SIP, when this is turned on, the the fuse will no longer load at all.

output of

kextstat|grep fuse


So, with System integrity protection ( SIP ) Fuse will no longer load, for some reason.


When fuse is not loaded, of course I get some funky error messages :

kext load failed: -603946989
sysctl: unknown oid 'vfs.generic.osxfuse.tunables.allow_other'
kext load failed: -603946989
mount_osxfuse: the file system is not available (255)


So , I go back to turning the SIP off for now.....

Sep 24, 2020 12:22 PM in response to BDAqua

New "com.startup.plist" file

Now the file will load and run at boot.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.startup</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/bash</string>
        <string>/Library/Scripts/Startup/startup.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/tmp/com.startup.stderr</string>
    <key>StandardOutPath</key>
    <string>/tmp/com.startup.stdout</string>
</dict>
</plist>


Now the LaunchDaemons startup file run... But, it is not time for celebration.

The remote server will still not mount at boot.

Error message from the file : "com.startup.stderr"


/mnt/rsync_net: Input/output error


Ok, so now I think there is some conflict with the mount points

I Specify the following mount points in the file "/Library/Scripts/Startup/startup.sh" :

Local mount point:

/mnt/rsync_net


But on this system, I have also configured Apple's automount.

So I suppose there is a conflict with the automount system

My list of mounts :


bash-5.0# compgen -c | grep ^mount
mount_sshfs
mount_hfs
mount_apfs
mount_udf
mount_cd9660
mount_sshfs
mount_exfat
mount_webdav
mount_msdos
mount_9p
mount_ntfs
mount_nfs
mount_ftp
mount
mount_afp
mount_smbfs
mount_cddafs
mount_fdesc
mount_acfs
mount_devfs
bash-5.0# 



Contents of the "/etc/auto_master"

#
# Automounter master map
#
+auto_master       # Use directory service
/net               -hosts       -nobrowse,hidefromfinder,nosuid
/home              auto_home    -nobrowse,hidefromfinder
/Network/Servers   -fstab
/-                 -static
/mnt/rsync_net     auto_sshfs   -nobrowse,nosuid


Contents of the "/etc/auto_sshfs"

/mnt/rsync_net -fstype=sshfs,port=22,local,volname=rsync_net,allow_other,auto_cache,defer_permissions XXXXX@prio.ch-s011.rsync.net:




Aug 28, 2020 8:01 AM in response to tormod_bjorøy

I will give an update on the matter.


I have made a com.startup.plist file in LaunchDaemons.

The file is saved in LaunchDaemons, and it does not work as intended. ( Does not run )

Here is my com.startup.plist file :


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

 <dict>

  <key>EnvironmentVariables</key>

  <dict>

   <key>PATH</key>

   <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string>

  </dict>

  <key>Label</key>

  <string>com.startup</string>

  <key>Program</key>

    <string>/usr/bin/env bash /Users/root/Scripts/startup.sh</string>

  <key>RunAtLoad</key>

  <true/>

  <key>KeepAlive</key>

  <false/>

  <key>LaunchOnlyOnce</key>

  <true/>

  <key>StandardOutPath</key>

  <string>/tmp/startup.stdout</string>

  <key>StandardErrorPath</key>

  <string>/tmp/startup.stderr</string>

  <key>UserName</key>

  <string>admin</string>

  <key>GroupName</key>

  <string>admin</string>

  <key>InitGroups</key>

  <true/>

 </dict>

</plist>


The intention of the file is to start a script at boot / startup of laptop.

Script is named : startup.sh


contents of script :

#!/usr/bin/env bash

#Load modules for Fuse

/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse

/usr/sbin/sysctl -w vfs.generic.osxfuse.tunables.allow_other=1

#Connect to rsync_net

/usr/local/bin/sshfs XXXX@prio.ch-s011.rsync.net: /mnt/sshfs -oauto_cache,reconnect,local,volname=rsync_net,allow_other,defer_permissions



Ok, so the script will not run at startup, because for some reason the com.startup.plist will not run at boot.

Regardless, I am able to run the script by terminal, but ONLY if I give this command in terminal :

Tormods-MacBook-Pro:Scripts tormod$ sudo bash startup.sh

Password:

vfs.generic.osxfuse.tunables.allow_other: 1 -> 1

Tormods-MacBook-Pro:Scripts tormod$ 


It is impossible to run the script by typing name of script, and enter.

So, some things is working and some things is not working.......

Any help appreciated !






Sep 18, 2020 9:33 AM in response to tormod_bjorøy

First you either need to make sure the script is in a directory that is included in the PATH or you need to specify the path to the script when executing the script. Also make sure the script's executable bit is set.


You can use "sleep" to pause the script to give the system time to do its thing. A better way would be to check to see if the connection is up. I'm not sure how to do the latter on a Mac.

Sep 5, 2020 12:13 PM in response to BDAqua

Thanks !


I looked in the launchd tutorial.

Here is the error codes I get when I try to run :

Tormods-MacBook-Pro:LaunchDaemons tormod$ launchctl load com.startup.plist


Error codes from Console.app :


Sep  5 21:08:08 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.apple.xpc.launchd.user.domain.501.100009.Aqua): com.startup (lint): UserName is not supported for non-System services.
Sep  5 21:08:08 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.apple.xpc.launchd.user.domain.501.100009.Aqua): com.startup (lint): GroupName is not supported for non-System services.
Sep  5 21:08:08 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.startup[680]): Could not find and/or execute program specified by service: 2: No such file or directory: /usr/bin/env bash /Users/root/Scripts/startup.sh
Sep  5 21:08:08 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.startup[680]): Service setup event to handle failure and will not launch until it fires.
Sep  5 21:08:08 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.startup[680]): Service exited with abnormal code: 78

Sep 7, 2020 3:51 AM in response to BDAqua

Thanks !


I think the problem is maybe in the chmod properties of directories, files or commands.

I belive the script will run as root user. So, what ownership / chmod should the directories where the script is located have ?

What ownership / chmod should the the script file have ?


I see there are several attributes for the osxfuse.

I find the different attributes here :

https://github.com/osxfuse/osxfuse/wiki/Mount-options

Now, I run : allow_other


The correct way is maybe : allow_root ?




Sep 22, 2020 4:44 PM in response to HWTech

Update :


Now, when I run this command :

bash-5.0# launchctl load /Library/LaunchDaemons/com.startup.plist


I get these error codes in system.log :

Sep 23 01:36:44 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.startup[1756]): Service could not initialize: 18G6020: xpcproxy + 11299 [1534][EF0898CB-4A82-3F6F-A7E6-C3F025B1A096]: 0x2
Sep 23 01:36:44 Tormods-MacBook-Pro com.apple.xpc.launchd[1] (com.startup[1756]): Service exited with abnormal code: 78


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mount filesystem over sshfs at system startup / boot Mojave 10.14.6

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.