Client Web Fragment Plugin Modules

SSH Request Handler Plugin Module


As you probably know, Bitbucket Server supports serving SCM hosting requests (i.e. pushes and pulls) over both HTTP/S and SSH. What you may not know is that Bitbucket Server supports another simple SSH command - whoami. If you have SSH enabled on your server and have uploaded your public key, try the following from the command line:

$ ssh -p 7999 whoami

(Replace 7999 with the port that your Bitbucket Server server running Bitbucket Server)

You should get a simple response with your username:


Neat, huh? What's even cooler is the fact that these commands are pluggable. The whoami command is actually provided by a simple bundled plugin in Bitbucket Server. You can implement your own SSH command support using the SSH Request Handler plugin module.

See the javadoc for SshScmRequestHandler and SshScmRequest for more details on implementing support for a new SSH command.


The root element for an SSH Request Handler plugin module is <ssh-request-handler/>. It allows the following attributes for configuration:


keyYesThe identifier of the plugin module. This key must be unique within the plugin where it is defined.N/A
classYes The fully qualified Java class name of the SSH request handler. This class must implement SshScmRequestHandler (don't worry about the 'Scm' in the name - non-SCM related commands are fine too). N/A


Here is a simple atlassian-plugin.xml with a single SSH Request Handler module:

<atlassian-plugin name="My SSH Command Handler" key="example.plugin.mysshcommand" plugins-version="2">
        <vendor name="${}" url="${project.organization.url}" />

    <ssh-request-handler key="my-ssh-command" class="com.example.myplugin.MyCommandSshRequestHandler" />

Rate this page: