Allow commands on a host
This guide lets chosen commands run on a server without a question, and keeps everything else asking. It assumes a key and a trusted host (Run your first command).
A rule for ssh_exec names a user, a host and a command:
admin@web.home.example systemctl status *A * word matches any one word; as the last word, any number of words, or none.
From an approval
When a chat asks Run a command on web.home.example as admin?, choose Always. Beneath it:
| Choice | Allows | Example for systemctl status nginx |
|---|---|---|
| This target | this exact command | admin@web.home.example systemctl status nginx |
| Wider | the command's first words, with any arguments after them | admin@web.home.example systemctl status * |
The wider choice keeps all but the last word, at most two: docker ps -a becomes docker ps *, uptime -p becomes uptime *. The sheet shows one wider choice; the same command on the parent domain (*.home.example) is another the daemon knows. A command that starts a runner, such as sh -c, python3 or sudo, keeps its exact words: no answer turns it into every command.
In the app
Open Permissions and tap
ssh_exec.Tap Add a command and type one rule per line:
textadmin@web.home.example systemctl status * admin@*.home.example uptimeUnder Gets, choose Chat (or an agent) and allow.
From the terminal
nocturn perms set chat ssh_exec 'admin@web.home.example systemctl status *' allow --reload
nocturn perms set agent:backup ssh_exec 'admin@nas.home.example restic *' allow --reloadPatterns
| Part | Syntax |
|---|---|
| user | a login, or *; optional |
| host | web.home.example, *.home.example (the domain and its subdomains), or * |
| port | :2222, only when it is not 22 |
| command | words; a * word is any one word, a last * any number; * and ? inside a word do not cross / |
A rule with no command is refused: write <host> * if you really mean every command. A bare * allows everything for that holder; the app marks it as a blank cheque.