Skip to content

ssh

Declarative SSH configuration. Define your includes, host blocks, and global options as a Lua table — rootbeer generates the ~/.ssh/config file for you. Booleans are automatically rendered as yes/no.

lua
local ssh = require("rootbeer.ssh")

Example

lua
ssh.config({
    includes = { "~/.ssh/private.config" },
    hosts = {
        ["*"] = {
            ForwardAgent = true,
            Compression = true,
            ControlMaster = "auto",
            ControlPath = "/tmp/ssh-%C",
            ControlPersist = true,
        },
    },
})

API Reference

config(cfg)

Generates an SSH config file from structured data.

hoststable<string, table<string, boolean|string|number>>optional
Host blocks. Keys are match patterns (e.g. "*", "github.com"), values are option tables.
includesstring[]optional
Paths added as Include directives at the top.
pathstringoptional
Where to write the SSH config. Defaults to "~/.ssh/config".