How to mount remote Internet volumes to use in Mac’s finder

Configurare noua (How To)

Situatie

If you regularly deal with remote volumes like a web server, you can get tired of interacting purely using a command line. Fortunately, you can use SSH functionality to mount a remote instance volume on your Mac and interact with it using Finder as if it were a local volume.

Solutie

Avoids Inherent Limitations of Google Drive Desktop

Google Drive is an immensely popular choice for cloud storage, but its desktop app can be a touch restrictive. You may have noticed that syncing big files can be slow, and accessing your entire Drive without using up local storage can be a problem. For instance, Google Drive has a history of nasty habits like eating up tons of local storage in excessive cache files tucked away in hidden directories.Or maybe you have noticed that some other apps refuse to “see” the default macOS file path where cloud storage volumes are located. You can circumvent both of these using macFUSE and SSHFS. Though it takes some doing outside the scope of this specific guide, these tools can be used to mount your Google Drive or other remote storage as if it were local.This can serve to bypass these limitations, giving you direct access to your files without the need to actually sync them.

Smooth Out your Dual-Boot Config

If you run a dual-boot system with macOS and another operating system, you already know how cumbersome accessing those files can be when you’ve booted into macOS. Skip all that extra fuss by using these tools to mount volumes associated with your other OS directly and access them in your current Mac session, allowing management in a single environment.

Drag and Drop to Remote Volumes for a Better Workflow

I like working from the command line more than most, but mounting my remote volumes locally really speeds up my workflow, particularly when experiencing eye strain from looking at nothing but text for hours on end.For example, I run my personal website off of an AWS EC2 instance of Ubuntu Server. By nature, Ubuntu Server runs headless (without a graphic interface). When adding media to my web server, the ability to drag and drop files directly using Finder just flows faster than uploading via the terminal and also eliminates associated delays.

Provides a Platform to Experiment

For tech enthusiasts and hobbyists, experimenting with different filesystems and server configurations can be a fun and educational experience. macFUSE and SSHFS provide an easy way to mount and interact with various filesystems, from the comfort of your macOS environment. This capability is particularly useful for those looking to learn about networked storage, server management, or even developing their own custom filesystems, without needing to dive deep into complex configurations.

What You Need Before We Begin

Before we move on to mounting remote volumes, you’ll need to install a few additional bits of software.

macFUSE

macFUSE is software that improves macOS filesystem capabilities, allowing you to use different types of filesystems that aren’t natively supported. To install macFUSE, first visit the macFUSE GitHub repository.

Download the latest version of the macFUSE installer, open it and follow the on-screen instructions to complete the installation. After installation, you may need to enable system extensions in System Settings> Security & Privacy. macFUSE is essential for enabling the other prerequisite for configuration, SSHFS.

SSHFS

SSHFS stands for Secure SHell FileSystem. It is aptly named for its ability to allow users to mount remote filesystems over SSH. It uses the secure file transfer protocol (SFTP) to access files on a remote server, providing a secure and efficient way to manage remote data as if it were on your local machine. To install SSHFS, first make sure you have Homebrew installed on your Mac. Now open Terminal and run the command:

brew install sshfs

Using the SSHFS Command

Mounting a remote filesystem using SSHFS utilizes the following command structure:

sshfs [user]@[host]:[remote_directory] [local_mount_point] -o IdentityFile=[path_to_private_key]

Using an SSHFS Script Command For Running With Minimal Effort

The script I’ve written below simplifies the process of mounting a remote filesystem using SSHFS. It sets up the mount point, adjusts permissions, and mounts the remote filesystem with a custom volume name. Just replace the variables in the first section with those applicable to your remote volume.

#!/bin/zsh#

Change the following variable fields with your own applicable info

MOUNT_POINT=”path/to/desired/mount/point”LOCAL_USER=”YOUR macOS USERNAME”INSTANCE_USER=”YOUR REMOTE USERNAME”INSTANCE_DNS=”YOUR_INSTANT_DNS_ADDRESS OR URL”PRIVATE_KEY_PATH=”path/to/your/private/key.pem”VOLUME_NAME=”YOUR DESIRED VOLUME NAME”#

Create the mount point if it doesn’t exist

if [ ! -d “$MOUNT_POINT” ]; thensudo mkdir -p “$MOUNT_POINT”sudo chown “$LOCAL_USER”:staff “$MOUNT_POINT”sudo chmod 755 “$MOUNT_POINT”

else# Adjust permissions if the directory already existssudo chown “$LOCAL_USER”:staff “$MOUNT_POINT”sudo chmod 755 “$MOUNT_POINT”

fi

# Mount the remote filesystem with a custom volume namesshfs -o volname=”$VOLUME_NAME”,IdentityFile=”$PRIVATE_KEY_PATH” $INSTANCE_USER@$INSTANCE_DNS:/ “$MOUNT_POINT”# Open the directory in Finderopen “$MOUNT_POINT”

Once you’ve edited the script to fit your personal use case, save it as “mount_remote.sh”. Make it executable by opening Terminal and using:

chmod +x mount_remote.sh

Now run it using

./mount_remote.sh

This script automates the mounting process, making it quick and easy to access your remote files.

Tip solutie

Permanent

Voteaza

(5 din 9 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?