-good page on how to set it up.
-5. a reasonably fast connection. (This isn't really *neccessary*, but
-if your connection is too slow, this won't be very pleasant to use,
-and certainly won't seem transparent.)
-
-
-##Write a wrapper shell script##
-
-Now we will need to write a simple shell script that does two things:
-
-1. replaces the call to the notmuch binary with a call to notmuch
-over ssh.
-2. sets up a running, detached, ssh connection to the server, so that
-future calls can reuse the socket.
-
- #!/usr/bin/env bash
-
- SSH_BIN="ssh"
- USER="example_user"
- SSH_HOST="example.com"
- SSH_SOCKET="/tmp/notmuch_ssh.socket"
- NOTMUCH_REMOTE_BIN="notmuch"
- DTACH="dtach"
- DTACH_SOCKET="/tmp/notmuch_dtach.socket"
-
- check_for_socket ()
- {
- [ -S "${SSH_SOCKET}" ]
- }
-
- check_if_socket_alive ()
- {
- timeout 1 $SSH_BIN -S ${SSH_SOCKET} $USER@$SSH_HOST true > /dev/null
- }
-
- start_socket ()
- {
- dtach_command="${DTACH} -n ${DTACH_SOCKET} ${SSH_BIN} -M -S ${SSH_SOCKET} ${USER}@${SSH_HOST}"
- command -v ${DTACH} &>/dev/null && ${dtach_command} ||
- echo "${DTACH} not installed"
- }
-
- notmuch_run ()
- {
- check_for_socket || start_socket
- CMD=$1
- shift
- printf -v ARGS "%q " "$@"
- $SSH_BIN -S $SSH_SOCKET $USER@$SSH_HOST $NOTMUCH_REMOTE_BIN ${CMD} ${ARGS}
- }
-
- notmuch_run $@
-
-
-Save this to a file, "remote-notmuch.sh", in your path.
-
-Now you can run "remote-notmuch.sh new". You can call the script
-anything you like. I actually have $HOME/bin/notmuch linked to that
-script, so I can have transparent
-usage.
-
-##Configure your emacs client##
-
-The only thing you need to do is tell your emacs client to use the
-script. Add the following to your .emacs (this is on your client
-machine):
+good page on how to set it up (*).
+
+4. a reasonably fast connection. (This isn't really *necessary*, but if
+your connection is too slow, this won't be very pleasant to use, and
+certainly won't seem transparent.)
+
+(*) If you don't want / cannot use password-free login,
+[[This|remoteusage/aboriginal]] page provides yet another alternative.
+
+## Configure `ssh` on the client computer ##
+
+Add this to your `~/.ssh/config`:
+
+ Host notmuch
+ HostName example.com
+ User remoteuser
+ ControlMaster auto
+ ControlPath ~/.ssh/master-%h@%p:%r
+ ControlPersist 15m
+ IdentityFile ~/.ssh/example.com.id_rsa
+
+Replace `example.com` with your server. Replace `remoteuser` with the
+username on the server.
+
+The `Control*` options keep the connection open in the background to not
+require authentication every time. The `ControlPersist` option defines
+the connection timeout. These aren't strictly necessary, but reduce
+latency.
+
+The `IdentityFile` option may not be necessary depending on how you set
+up public key authentication. This assumes you set up a separate key;
+set the filename accordingly.
+
+Please refer to `ssh_config(5)` man page for details.
+
+## Set up a wrapper shell script on the client computer ##
+
+Save this to a file, for example `remote-notmuch.sh`, in your `PATH`:
+
+ #!/bin/bash
+ printf -v ARGS "%q " "$@"
+ exec ssh notmuch notmuch ${ARGS}
+
+and give it execute permissons: `chmod +x remote-notmuch.sh`
+
+Now you can run `remote-notmuch.sh new`, or other notmuch commands. You
+can call the script anything you like. (You could also call it `notmuch`
+or symlink `~/bin/notmuch` to it for transparent usage.)
+
+## Configure Emacs on the client computer ##
+
+Add this to your `~/.emacs` to tell the Emacs client to use the wrapper
+script: