Hacker News new | ask | show | jobs
by usrbinbash 682 days ago
Question: What is the specific advantage I get from using

    $ viking machine add --name deathstar --key starkey 168.112.216.50
    $ viking exec --tty deathstar /bin/bash
Over putting the following in my ~/.ssh/config

    Host deathstar
        HostName 168.112.216.50
        User my_user
        IdentityFile ~/.ssh/starkey
And then just typing

    $ ssh deathstar

?
1 comments

as someone who dislikes config files to an extreme degree (hidden information, commands stop being portable) a modern cli that allows me to manage my configurations seems very useful
> as someone who dislikes config files to an extreme degree

This tool has a config as well. From the repos readme:

    Viking saves data locally. Set VIKING_CONFIG_DIR env variable for a custom directory. Use viking config to check the current config folder.
> hidden information

What exactly is "hidden" about ~/.ssh/config ? It's a plaintext file in a format that is the same across every single machine that uses openssh, which is pretty much every *nix box on the planet.

> commands stop being portable

How is using literal `ssh` not portable? If you're talking about the ssh config: That is a plaintext file that can be checked into a repo and simply downloaded to any machine I want. And again: viking too has a config.

> a modern cli

    host=$(
        awk '$1 == "Host" && $2 != "*" {print $2}' "$HOME/.ssh/config" |
        fzf --reverse
    )
    [[ -n host ]] && ssh "$host"
There. I just built a modern, interactive tool to chose a server from my ssh config. It requires only fzf as a non-standard dependency, a tool that is present in pretty much every package repository.

> allows me to manage my configurations

    vim ~/.ssh/config
There. A powerful, searchable, portable way to manage my SSH configuration. I can even use comments, and have access to all ssh settings available. All dependencies come preinstalled on most *nix boxes.
While mature and time-honored, not modern, utilities like sed and envsubst go a long way to managing any config. Making a "modern cli" application that wraps existing functions is like giving someone a fish, as opposed to teaching them to fish with stable and ubiquitously available tools.

Create entry (using a template and exported variables):

  $ envsubst < .ssh/template.config >> .ssh/config
Read entry (assuming the 4 line template):

  $ sed -n /<Host entry>/,+3p .ssh/config
Update entry: Delete and Create

Delete entry (assuming the 4 line template):

  $ sed -i /<Host entry>/,+3d .ssh/config
this site has only two audiences. nerds and mba's.

you're in a nerd thread, and will be downvoted without comments by starting an unwillingness to deep knowledge for the sake of knowledge.

if this were a mba thread the opposite would happen.

that said, shame on you for wanting ignorance!