Code Monkey home page Code Monkey logo

sshw's Introduction

sshw

GitHub GitHub tag (latest by date)

ssh client wrapper for automatic login.

usage

install

use go get

go install github.com/yinheli/sshw/cmd/sshw@latest

or download binary from releases.

config

config file load in following order:

  • ~/.sshw
  • ~/.sshw.yml
  • ~/.sshw.yaml
  • ./.sshw
  • ./.sshw.yml
  • ./.sshw.yaml

config example:

- { name: dev server fully configured, user: appuser, host: 192.168.8.35, port: 22, password: 123456 }
- { name: dev server with key path, user: appuser, host: 192.168.8.35, port: 22, keypath: /root/.ssh/id_rsa }
- { name: dev server with passphrase key, user: appuser, host: 192.168.8.35, port: 22, keypath: /root/.ssh/id_rsa, passphrase: abcdefghijklmn}
- { name: dev server without port, user: appuser, host: 192.168.8.35 }
- { name: dev server without user, host: 192.168.8.35 }
- { name: dev server without password, host: 192.168.8.35 }
- { name: ⚡️ server with emoji name, host: 192.168.8.35 }
- { name: server with alias, alias: dev, host: 192.168.8.35 }
- name: server with jump
  user: appuser
  host: 192.168.8.35
  port: 22
  password: 123456
  jump:
  - user: appuser
    host: 192.168.8.36
    port: 2222


# server group 1
- name: server group 1
  children:
  - { name: server 1, user: root, host: 192.168.1.2 }
  - { name: server 2, user: root, host: 192.168.1.3 }
  - { name: server 3, user: root, host: 192.168.1.4 }

# server group 2
- name: server group 2
  children:
  - { name: server 1, user: root, host: 192.168.2.2 }
  - { name: server 2, user: root, host: 192.168.3.3 }
  - { name: server 3, user: root, host: 192.168.4.4 }

callback

- name: dev server fully configured
  user: appuser
  host: 192.168.8.35
  port: 22
  password: 123456
  callback-shells:
    - { cmd: 2 }
    - { delay: 1500, cmd: 0 }
    - { cmd: "echo 1" }

sshw's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sshw's Issues

Add cmd option auto run after login

Would be great if can config command auto run after login. For example:

{ name: dev server, user:, host: 192.168.8.35, cmd: auto run command after login }

Can't install sshw on Ubuntu 18.04

Hi!

When invoking the command go get -u github.com/yinheli/sshw/cmd/sshw I"m getting the following:
import cycle not allowed
package github.com/yinheli/sshw/cmd/sshw
imports flag
imports errors
imports internal/reflectlite
imports runtime
imports internal/cpu
imports runtime

New Release

@yinheli - Can you release new binaries based on the master branch - to incorporate the recent bug fixes you've merged in?

ssh to domain

such as

in .sshw

- { name: xx-mysql , user: myser1, host: mysql1 }

Error message on .ssh/id_rsa even if keys are not defined as auth method

I have a configuration file where all my hosts are accessed via a password.
However, when I launch sshw and connect to a server I see the following message:
[sshw] 2020/10/13 18:19:03 [error] open /Users/sasadangelo/.ssh/id_rsa: no such file or directory

Basically, by default, it adds the key auth method assuming I have a key in .ssh/id_rsa.

I fixed the problem in this way:
sasadangelo@4fc8d47
but not sure if correct. If so, I can do PR.
Let me know.

Use `~/.ssh/config`

Would be great if it uses SSH config file instead of a custom one.

So we can reuse hosts with different apps without having duplicated configurations, for example git: git clone ssh://gitserver/repo.git.

Feature idea: dinamic hosts from cloud metadata

Hello!

First, thanks for this amazing idea! It is really useful to remove overhead over SSH connection management!

I have a feature idea: I think there are lots of people that have the need of managing cloud instances (EC2, GCE, AzureVMs) which change constantly due to a dynamic environment.

Because of this, it may be a bit challenging to manage the static configuration files on every change, and also spread it accordingly across the team.

So my idea would be to have support to add dynamic hosts based on Cloud host metadata, e.g. get the Name, login user and internal or public IP of a specific host on EC2, and then be able to select them (using ssh keys or even asking for password if none).

Do you think it's something you think that this tool could benefit from? I would love to help with this, however I have zero experience with Go (but would be happy to learn by doing it).

Cheers,
Eduardo

installed false:module declares its path as: golang.org/x/lint

$ go get -u github.com/yinheli/sshw/cmd/sshw
go: finding golang.org/x/lint latest
go: finding golang.org/x/crypto latest
go: finding github.com/alecthomas/units latest
go: finding golang.org/x/tools latest
go: finding golang.org/x/sys latest
go: finding github.com/gordonklaus/ineffassign latest
go: finding github.com/kevinburke/ssh_config latest
go: finding github.com/google/shlex latest
go: finding github.com/chzyer/readline latest
go: finding gopkg.in/alecthomas/kingpin.v3-unstable latest
go: finding github.com/golang/lint latest
go: finding github.com/tsenart/deadcode latest
go: finding github.com/juju/ansiterm latest
go get: github.com/golang/[email protected] updating to
	github.com/golang/[email protected]: parsing go.mod:
	module declares its path as: golang.org/x/lint
	        but was required as: github.com/golang/lint

I could use it by download binary,thanks,but I still want to figure out the problem;

Is working on windows ?

I run sshw on windows , but I got error message:
[sshw] 2019/11/07 09:40:59 [error] The handle is invalid.

ProxyCommand

is there any way to use ssh-bastion servers with ProxyCommand?

[Feature Request] Separate credentials definition

Hi,

I have a system with a lot of environments: env1, env2, env3.
To all the env I access through a Jump machine J1, let's call it jump1 with credentials C1.
In each env, I have a main machine M1 and I can access all the others only through M1. All the machines (but J1) can be accessed via SSO with credentials C2.

I would be a good idea to define the credentials in the .sshw file separately:

J1_Access:
user: xxxxx
password: yyyy

SSO_Access:
user: hhhhh
password: nnnnn

So that in the rest of the YAML file I can reference SSO_Access and J1_Access without specifying it every time for every machine. When a password is changed I only have to change it in a single point.

This is how Termius on Mac works. The problem is that it is not free.

Search

Search fails for children, otherwise cool stuff!!

Problem using SSH Keys

There is a problem when using SSH Keys, it looks like its not able to read the key for some reason or use the stored ssh agent.

[sshw] 2018/07/24 11:44:01 [error] ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

Version Information

Using -version doesnt actually show the version of sshw you are using.

./go/bin/sshw -version
sshw - ssh client wrapper for automatic login
  git version: devel
  go version : go1.10.3

ssh_config version err

github.com/kevinburke/ssh_config v1.2.0 err
shoud be
github.com/kevinburke/ssh_config v0.0.0

SSH Port Forwarding?

Hello, nice tools☺️!

I would like to request a feature that supports the ssh port forwarding since we need to do the remote debug over ssh port forwarding~

The base cmd of ssh local port forwarding is:

ssh -L <local port>:<remote host>:<remote port> <SSH hostname>

Thanks so much!

password

Password cannot be used "!" at the beginning .
eg:

  • name: ztc
    children:
    • { name: front, user: root, host: 172.16.0.243, port: 22, password: !4wO8I }

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.