Mount remote directory over ssh

When dealing with remote machines, it’s common to transfer files using scp. For example, to copy a local file to a remote host:

scp <path>/<to>/<local file> user@remotehost:<path>/<to>/<remote file>

This is perfect for single files or directories but sometimes it’s useful to have a local mount point for performing file operations. Using sshfs can mount the remote directory. You can install following these directions, or on Debian based using

sudo apt-get install sshfs

First, create a local directory for a mount point:

sudo mkdir /tmp/mount_point

Then mount the remote directory:

sudo sshfs -o allow_other,default_permissions user@remotehost:/<path>/<remote directory> /<path>/<local directory>

To unmount use:

sudo umount /<path>/<local mount point>