# Remote settings and remembered credentials The source library includes Linux filesystem storage, now connected to the [source command](command.md) through explicit settings, key and pin actions. Opening, reading and writing this store performs no network I/O and creates no session consent. Nothing auto-connects at startup. `settings.toml` contains format version 1, plain-language role (`controller` or `controlled`), relay host/port and an optional previously approved SHA-256 pin. The pin repeats its host and port; a mismatch or invalid/zero digest is rejected. Pin validation uses the same endpoint contract as the TLS transport. There is no trust-on-first-use, changed-pin replacement, or certificate approval action in this storage layer. The connection UI obtains that decision explicitly. The schema contains no channel key, connection epoch, peer, lease, keyboard grant, clipboard consent, reconnect switch or startup-connect switch. Unknown fields, duplicate fields, unsupported versions and invalid endpoints are rejected. `channel-key.toml` is separate and written only by an explicit `rememberKey` call. It contains version 1, relay host/port and the key. A key is returned only for the exact saved endpoint. Changing relay settings does not copy a key to the new endpoint; the old saved key remains unused until explicitly replaced or forgotten. `forgetKey` removes and syncs the credential file and is idempotent. Removal is not a promise of secure disk erasure. Saving ordinary settings never saves a key, and there is no saved-key flag that silently triggers a connection. `recent.toml` separately holds up to ten successfully joined host, port, mode and key entries, newest first, with any explicitly remembered certificate pin. It is written only when Remember this host and key is checked for that attempt. The connection form offers this option checked by default; uncheck it before Connect to avoid adding a new key to history. An empty Key can reuse the entry matching the selected endpoint and mode. Labels and presentation never include its key. Forget recent connections removes this file, independently of the explicit saved-key slot. No entry restores consent or starts a connection. Keys use the transport's existing validation: nonempty valid UTF-8, at most 512 bytes, without C0 controls or DEL. The transport and store share that validator. Settings and the saved-key slot are each bounded to 8 KiB on read; recent connections are bounded to 16 KiB. Parser errors are replaced with a generic error, without the file path, parser excerpt or key. Ordinary settings can therefore be inspected separately from credential content. The caller supplies an absolute, clean directory path whose parents already exist. The final directory is created with mode 0700 if absent. Every component is opened relative to the preceding directory with no symlink following. A symlinked settings location is refused. The final directory must belong to the current user and have no group/other permissions; existing unsafe permissions are rejected rather than changed automatically. All files, including the cooperating-process lock, must be current-user regular files with no group/other permissions and exactly one hard link. Symlinks, FIFOs, devices and hard links are refused. File opens use nonblocking/no-follow flags so an unexpected FIFO cannot hang the reader. Credential operations run on the external command worker, not an input or native UI callback. Writers use an exclusive mode-0600 temporary file under the owned directory descriptor, sync it, rename within the directory, and sync the directory. They never follow or truncate an existing destination. A mutex serializes callers; a nonblocking flock excludes cooperating processes. Temporary files are removed after normal failures. Abrupt process death can leave an owner-only `.pending-*` file; it is never read as live settings. A directory-sync failure after rename can leave the new version present despite an error, so the UI must report the failure and re-read before claiming which value was saved. These files are independent atomic records, not a cross-file transaction. The key is plaintext protected by filesystem ownership and permissions. This is not encryption, an OS keyring, or protection against malicious same-user code. No runtime data is added to release archives. Tests use disposable directories and synthetic keys. They cover restart, exact endpoint scoping, atomic inode replacement, permission modes, temporary-file cleanup, explicit forgetting, host/port pin mismatch, unknown fields/versions, malformed and oversized files, symlinked ancestors, file symlinks, hard links, FIFOs, unsafe lock files, competing locks and secret-free errors. They do not establish physical-input UI acceptance or power-loss durability on every filesystem. ```sh GOCACHE=/tmp/cthulhu-cache GOPROXY=off go test -race ./remote/src -count=1 -timeout=60s make check ```