# `mount-ssh`

John Simpson `<jms1@jms1.net>` 2018-06-28

I use this script to simplify using `sshfs` to mount remote servers on my local machine.

[https://keybase.pub/jms1/sshfs/](https://keybase.pub/jms1/sshfs/) shows you the raw contents of this directory, rather than this rendered Markdown file.

## Setup

### Install the script

I always have `~/bin/` in my `PATH`, so I just copied the script to that directory.

```
$ cd ~/bin/
$ curl -O https://keybase.pub/jms1/sshfs/mount-ssh
```

Make sure the script is executable.

```
$ cd ~/bin/
$ chmod 0755 mount-ssh
```

If you have a set of servers that you SSH into on a regular basis, you can create *hard links* to the script in this directory. (A hard link is essentially a second name for the same file.) The new link's filename should be "`mount-`" followed by the hostname. For example, if the server's hostname is `scooby`...

```
$ cd bin
$ ln mount-ssh mount-scooby
```

### Create the `~/mnt/` directory

On your local machine, create a `~/mnt/` directory. This is where the mounted filesystems will appear.

If you want custom icons for each server, you can place `.icns` files with the server's hostname in this directory. For example, if you have a server called `scooby`, you would name its icon file "`scooby.icns`".

## Run the script

Once the script is installed, run it.

```
$ mount-scooby
```

If you are normally prompted for a password or a secret key passphrase, you will be prompted for that. Once you enter it, the filesystem will be mounted.

```
$ df scooby:/
Filesystem 512-blocks      Used Available Capacity iused    ifree %iused  Mounted on
scooby:/    952582240 394488616 509705224    44%  352222 29892642    1%   /Users/jms1/mnt/scooby
```
