SSH Helper

Categories

Component ID

1890160

Component name

SSH Helper

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

589

Component created

Component changed

Component body

Allows you to generate a SSH key pair (public/private) for that site using ssh-keygen and use the phpseclib library. There is a composer.json file included so that you can easily install the dependencies.

Admin path can be found at admin/config/services/ssh-helper

This becomes very useful if you deploy the public key to a server and then do remote execution on those servers from within Drupal

A use-case example to run the beep command as root on the drupal.org servers (provided that you have access using the right key/pair combination, which you most probably don't!)

// Get our SSH key and pass
$key = ssh_helper_load_key();
// This will be our connection class, hostname is obligatory
$ssh = ssh_helper_load_ssh('www.drupal.org');
$ssh->login('root', $key);
$ssh->exec('beep');