KOSHI0.4.0
Using koshi
v0.4usingfield manual

Sharing with other users

Let the other users logged in to this machine list, attach to, and kill your koshi sessions — and choose where the shared session sockets live.

Your sessions are yours alone unless you say otherwise. No other user of this machine can see them or reach them.

This is about the other users of this machine. Reaching a session from another machine is remote access, and neither key turns the other on.

Turn it on

koshi.kdl
version 1
allow-other-users #true

Both files have to say so. Your koshi.kdl opens your sessions to other users. Their own koshi.kdl makes their koshi look for sessions that are not theirs. A user who leaves it off sees only their own sessions, whatever your file says.

Turn it on for a machine several people share on purpose — a build box, a lab machine, a pair-programming host. Leave it off on a laptop.

The programs inside a session keep running as the user who started it, whoever attaches. Attaching never hands anyone your account; it hands them a view of, and typing into, panes that still run as you.

When the setting takes effect

The session reads koshi.kdl again for every connection and every request another user makes, so turning it off shuts those users out without a restart: a new connection is refused, and a terminal already attached is dropped the next time it types.

Every koshi command reads the file again as it runs, so a listing shows what your file says at that moment.

Turning it on reaches the sessions you start after the change. A running session keeps the socket it already has until it restarts. koshi update restarts every session it finds, and a restarted session reads this key again and binds where your file says at that moment.

One session, for its whole life

koshi --headless --allow-other-users

That session serves the other users of this machine for its whole life, whatever koshi.kdl says. It never reads the key.

--allow-other-users goes only with --headless.

Where the sockets live

koshi.kdl
version 1
shared-sessions-dir "/var/run/koshi"

Set it to a directory every user who shares the machine can enter. Leave it out and koshi uses the machine-wide directory for the platform:

PlatformDefault
Linux, macOS/tmp/koshi
Windows%ProgramData%\koshi

Every user who shares the machine has to name the same directory. A user whose file names a different one looks in that one and finds nobody.

This only says where the sockets go. Nobody else reaches them until allow-other-users is on.

Your own sessions

Sessions that are not shared are advertised in one directory per user:

PlatformDirectory
Linux, macOS/tmp/koshi-<your user id>
Windowsrun under your application data directory

On Linux and macOS the name is built from your user id and nothing else, so every shell you open finds the same sessions.

KOSHI_RUNTIME_DIR names another directory, and koshi reads it only when it holds an absolute path. A relative value is ignored.

Two koshi processes holding different KOSHI_RUNTIME_DIR values use different directories and do not find each other.

Check it

koshi doctor

The session directory row names where sessions are advertised and who may reach that directory. The runtime directory row names the directory in use and the rule that produced it.

runtime directory   ok  /tmp/koshi-1000 is ready; koshi names it after your user id
session directory   ok  sessions are advertised in /tmp/koshi-1000 (mode 700), which only you may reach

On this page