sshcommand

Turn SSH into a thin client specifically for your app

  • Owner: dokku/sshcommand
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

sshcommand Build Status

Simplifies running a single command over SSH, and manages authorized keys (ACL) and users in order to do so.

It basically simplifies running:

ssh user@server 'ls -l <your-args>'

into:

ssh ls@server <your-args>

Commands

sshcommand create     <USER> <COMMAND>          # Creates a user forced to run command when SSH connects
sshcommand acl-add    <USER> <NAME> <KEY_FILE>  # Adds named SSH key to user from STDIN or argument
sshcommand acl-remove <USER> <NAME>             # Removes SSH key by name
sshcommand list       <USER> [<NAME>]           # Lists SSH keys by user and an optional name
sshcommand help       <COMMAND>                 # Shows help information
sshcommand version                              # Shows version

Example

On a server, create a new command user:

$ sshcommand create cmd /path/to/command

On your computer, add authorized keys with your key:

$ cat ~/.ssh/id_rsa.pub, ssh root@server sshcommand acl-add cmd progrium

If the public key is already on the server, you may also specify it as an argument:

$ ssh root@server sshcommand acl-add cmd progrium ~/.ssh/id_rsa.pub

Now anywhere with the private key you can easily run:

$ ssh cmd@server

Anything you pass as the command string will be appended to the command. You can use this
to pass arguments or if your command takes subcommands, expose those subcommands easily.

$ /path/to/command subcommand

Can be run remotely with:

$ ssh cmd@server subcommand

When adding an authorized key, you can also specify custom options for AUTHORIZED_KEYS
by specifying the SSHCOMMAND_ALLOWED_KEYS environment variable. This should be a list
of comma-separated options. The default keys are as follows:

no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding

This can be useful for cases where the ssh server does not allow certain options or you
wish to further constrain a user's environment. Please see man sshd for more information.

Main metrics

Overview
Name With Ownerdokku/sshcommand
Primary LanguageShell
Program languageShell (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2013-06-12 00:31:01
Pushed At2025-06-12 06:09:22
Last Commit At
Release Count23
Last Release Namev0.20.0 (Posted on )
First Release Namev0.1.0 (Posted on 2016-04-02 21:55:53)
用户参与
Stargazers Count381
Watchers Count10
Fork Count50
Commits Count353
Has Issues Enabled
Issues Count11
Issue Open Count0
Pull Requests Count128
Pull Requests Open Count2
Pull Requests Close Count65
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private