Code Monkey home page Code Monkey logo

Comments (10)

felixbuenemann avatar felixbuenemann commented on May 23, 2024

I guess the logic would have to be:

  • Check if the host has a user
  • Check if the ssh_options define a user
  • Fallback to local_user (or whatever is used currently to determine the local user)

from airbrussh.

mattbrictson avatar mattbrictson commented on May 23, 2024

Thanks for the report!

I don't quick understand what you mean in your third point: "fallback to local_user". Do you mean the equivalent of running whoami on the remote host? I don't know if there is precedence for that in SSHKit.

I can definitely check the ssh_options, though, which should fix this particular issue.

from airbrussh.

felixbuenemann avatar felixbuenemann commented on May 23, 2024

If no user is specified, sshkit uses either the user from ~/.ssh/config, or if not defined, the current local user, just like ssh example.com would do.

Maybe there's a way to ask sshkit for the actual user it is going to use?

from airbrussh.

mattbrictson avatar mattbrictson commented on May 23, 2024

The user is determined by net-ssh, which is the underlying library that SSHKit uses. If we had access to the net-ssh Session object, we could probably get the user from it, but the session is not currently exposed by SSHKit's logging facility.

If you think there is a strong case to be made for logging the actual user (as implied by ~/.ssh/config, for example), I suggest you open an SSHKit issue requesting it.

In the meantime, do you think checking for ssh_options[:user] is an acceptable interim fix?

from airbrussh.

felixbuenemann avatar felixbuenemann commented on May 23, 2024

Yes I think it is.

Falling back to the local user, if we're not sure it is actually correct is probably a bad idea…

from airbrussh.

mattbrictson avatar mattbrictson commented on May 23, 2024

This is a bit tricker than I thought (see my failed attempt in PR #66), so I am going to put this on the back-burner for now. Addressing this issue means Airbrussh will have to make some assumptions about how net-ssh works, which makes me a little uncomfortable.

@felixbuenemann if you want to take a stab at a PR I will consider merging it.

from airbrussh.

felixbuenemann avatar felixbuenemann commented on May 23, 2024

Hmm, can't you access the global ssh_options from inside the formatter?

from airbrussh.

mattbrictson avatar mattbrictson commented on May 23, 2024

@felixbuenemann I think my PR will work after all. Let's move the conversation over to #66.

from airbrussh.

mattbrictson avatar mattbrictson commented on May 23, 2024

Fixed by #66.

This will be included in Airbrussh 0.8.0 (release date TBD).

from airbrussh.

mattbrictson avatar mattbrictson commented on May 23, 2024

Released today in Airbrussh 0.8.0.

from airbrussh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.