capistrano / capistrano/sshkit

Feature: Ability to login as one user and run all tasks as another

Open
#262 21 comments 5 reactions 0 assignees View on GitHub
enhancement need more info
Dominant language
Ruby
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

We've created a [backend](https://github.com/fundingcircle/sshkit-backends-netssh_global) that allows Capistrano 3 to work with setups that require users to login in as user A, but run all commands as user B.

The backend essentially sets a global `owner` and all tasks (unless explicitly overridden) will run as this user. There are a few other options that can also be globally configured (this helps get around certain use cases) such as `directory` and the ability to forward an SSH agent to the owner for certain commands. This means the existing Capistrano tasks do not need to be reimplemented (instead the backend is switched).

While this kind of server setup is not recommended or ideal, when coming across one it's still useful to be able to use Capistrano to deploy.

The code is pretty ugly at the moment, subclassing and overriding a lot of private methods. However, if core sshkit are interested this could easily be cleaned up. The test suite style and methodology has been retained to try and make it as easy as possible to merge into core sshkit.

Does this look like a feature that you would be interested in merging into core? If so I can raise a PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.