Skip to content

SSH Connections

SSH is Knot's core entry point. Save a server alias with knot add, then open an interactive SSH session with knot ssh [alias]. The background daemon keeps reusable connections alive so later exec, sftp, cp, and forwarding operations can reuse the same connection path.

knot ssh

sh
knot ssh [alias]
ArgumentRequiredDescription
[alias]YesServer alias to connect to.

Example:

sh
knot ssh web-prod

Shortcut

When the root command receives an unknown first argument, it treats it as a server alias and rewrites the invocation to knot ssh [alias]:

sh
knot web-prod

Equivalent to:

sh
knot ssh web-prod

To avoid ambiguity, shortcut aliases cannot match built-in commands and cannot contain whitespace, path separators, or common shell metacharacters.

Add a Server

sh
knot add [alias] [flags]
FlagTypeDefaultDescription
-H, --hoststringemptyServer host name or IP address.
-P, --portint22SSH port.
-u, --userstringemptySSH username.
-p, --passwordstringemptySSH password. Prefer interactive input when possible.
-k, --keystringemptyManaged key alias to use for key authentication.
--auth-methodstringemptyAuthentication method: password, key, or agent.
--known-hostsstringemptyKnown hosts file path for this server.
-J, --jump-hoststringemptyComma-separated jump host alias chain.
--proxystringemptyManaged proxy alias.
-t, --tagsstringemptyComma-separated server tags.

Examples:

sh
knot add web-prod --host 1.2.3.4 --user deploy --key deploy-key --tags prod
knot add db --host 10.0.0.5 --user root --jump-host bastion

When host and user are provided, the command runs non-interactively. Otherwise it starts a guided prompt.

Edit a Server

sh
knot edit [alias] [flags]

Most options match knot add, with these common edit-specific operations:

FlagDescription
--aliasRename the server alias.
-J, --jump-hostSet jump hosts. Passing an explicitly changed empty value clears them.
--proxySet a managed proxy. Passing an explicitly changed empty value clears it.
-t, --tagsSet tags. Passing an explicitly changed empty value clears them.

Examples:

sh
knot edit web-prod --host 1.2.3.5
knot edit web-prod --alias web-blue --tags prod,blue

If no edit flags are provided, Knot opens an interactive editor.

List and Remove Servers

sh
knot list [pattern]
knot remove [alias]

knot list has the alias knot ls and can filter by alias, user, host, or tags with case-insensitive matching.

knot remove has the aliases knot rm and knot delete.

sh
knot list prod
knot rm old-host

Jump Hosts and Proxy

Server profiles can describe both jump hosts and proxy paths:

sh
knot add app --host 10.0.1.20 --user deploy --jump-host bastion --proxy corp
  • --jump-host references existing server aliases. Multiple jump hosts are comma-separated.
  • --proxy references a managed proxy from Proxy.