IT/Cloud/Remote Shares/MacOS
Access restrictions were established for this page. If you see this message, you have no access to this page.
- This method works but is by no means perfect and could be drastically improved. See the issues
- I started to make a bash script to do everything here but ran into problems and decided it wasn't worth it
Installation
Use Terminal
- Install Homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install osxfuse and sshfs
brew cask install osxfuse
brew cask install sshfs
- SSHFS is now installed
Mounting a folder
- Using Terminal
echo "<password>" | /usr/local/bin/sshfs -o password_stdin <username>@<hostname>:<remote folder (must be relative to / without a ~)> <local folder>
What a proper installation looks like
- /home/$USER/
- msgvtefiles/
- Use This.app
- Runs:
- umount -f /home/$USER/msgvtefiles/msgvtefiles
- echo "<password for server>" | /usr/local/bin/sshfs ...
- Runs:
- msgvtefiles/
- IT/
- Admin/
- etc
- Use This.app
- msgvtefiles/
Known issues
- The big issue is that although the folder is mounted it is not persistent. It breaks if the computer even goes offline, much less restarts. MacOS does not have an fstab file, (actually it does but the OS never uses it. WHY?) so we make a script to mount it again automatically.
- The issue with that is that Mac doesn't let you run bash scripts easily without Terminal. So we use the Mac default program Automator to make ourselves an app to run the scripts.
- The force unmount of the folder is not safe, but it has to be forced to fix errors
- If the folder is mounted and a document is opened followed by the mount breaking, then when the document is saved LibreOffice will error out and you risk losing data.
- This happened a couple times and both times the data was successfully recovered thanks to LibreOffice autosave
- The automatic recovery failed but I was able to extract the file from LibreOffice's autosave location.
- The file will save fine if before saving you run the app to ensure the mount is working
- This happened a couple times and both times the data was successfully recovered thanks to LibreOffice autosave
Making it (semi) automatic
- Create a standardized directory structure to help us
mkdir -p ~/msgvtefiles/msgvtefiles
- Obviously replace msgvtefiles with the correct name
- The first msgvtefiles will contain our script and the second will be the actual mount
- Create the script
- Open Automator
- Create new Application
- Add into the workflow "Run Shell Script"
- Command:
umount -f /home/$USER/msgvtefiles/msgvtefiles
- This is to prevent errors about the folder already being mounted (Because errors means I get emails whether the errors mean anything or not)
- Also if you leave this out the mount will sometimes get stuck and need to be forcibly unmounted.
- I realize this isn't very safe but it is here for lack of a better way
- Command:
- Add another "Run Shell Script" into the workflow
- Command:
echo "<password for server>" | /usr/local/bin/sshfs -o password_stdin <username>@<hostname>:<remote folder (must be relative to / without a ~)> <local folder>
- <remote folder> will be something like "/home/msgvte/msgvtefiles"
- <local folder> will be something like "/home/$USER/msgvtefiles/msgvtefiles"
- Command:
- Test and deal with inevitable errors
- Save in ~/msgvtefiles
- Now we can remount the share by double clicking the app we made.
- Optional: Put the ~/msgvtefiles folder in the favorites in Finder
- Mac users don't really use the home folder so they may have a hard time finding it otherwise