GithubHelp home page GithubHelp logo

ykankaya / sshp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chernjie/sshp

0.0 1.0 0.0 44 KB

Host chaining, search available configuration and other helpful commands for everyday ssh-related task.

Shell 100.00%

sshp's Introduction

sshp

Host chaining, search available configuration and other helpful commands for everyday ssh-related task.

To Use

$ sshp
sshp <HOST>
	Login to MACHINE

sshp <HOST1>+<HOST2>
	Login to HOST2 via HOST1

sshp [info] [pattern]
sshp [grep] [pattern]
sshp [search] [pattern]
	search your ~/.ssh/config and accepts all options of grep

sshp [list|-l]
	list all hosts

sshp [start|status|stop] <HOST..>
	Check the SSH connection status of a HOST

sshp proxy <HOST>
	HOST as proxy server

Host chaining

sshp supports host chaining, this take advantage of ProxyCommand and establish a connection for you. Your local machine will need to have nc installed for this to work.

$ sshp host1+host2

This will first attempt a connection to host1, then once a connection is established it will reuse that connection to login to host2

Configuration for both host1 and host2 can be configured in ~/.ssh/config. Alternatively you can also set it directly.

$ sshp user1@host1+user2@host2

Chaining multiple host with + can work too.

Additionally, you can set the following in your ~/.ssh/config so that you use ssh command directly.

Host *+*
	ProxyCommand sshp ProxyCommand %h %p
Example
$ ssh host1+host2

To Setup

  1. Add the following to your ~/.ssh/config. This will use Shared SSH connections

Host * ForwardAgent yes ControlMaster auto ControlPath /tmp/%r@%h:%p ControlPersist 4h KeepAlive yes Compression yes UseRoaming no


2. Add `sshp` to your `~/bin` directory


#### Advanced

If you want to separate your configuration files to smaller chunks, you can do so by creating a `~/.ssh/config.d` directory and `sshp` will consolidate all files found in this directory into `~/.ssh/config`
Beware, this will overwrite your `~/.ssh/config` whenever there are changes in `~/.ssh/config.d`.

#### Reference

For more information on how to configure your `~/.ssh/config`, see http://linux.die.net/man/5/ssh_config

sshp's People

Contributors

chernjie avatar

Watchers

 avatar

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.