RexOps / RexOps/Rex

Get default user from ssh config file

Open
#681 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Currently rex tries to get the username to be used for making an SSH connection from different places, in order as seen in Rex::Config->get_user:

  • REX_USER environment variable
  • user setting in Rexfile
  • getlogin
  • getpwuid($<)

It would be nice if we could try using the username set in ~/.ssh/config for a given host. Reading and parsing the SSH config file is already there in Rex::Config, but we probably need to somehow pass the servername in question and see if it matches any of the SSH config entries.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Rex::Config, especially Rex::Config->get_user and the existing ~/.ssh/config parsing. Trace how the target server name is available during SSH setup, then determine how a matching SSH config user should fit into the stated username lookup order. Done means a matching configured SSH username is used for that host without changing the existing fallbacks.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
devops, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.