Coder Social home page Coder Social logo

robozman / ssh-port-forward Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 3.0 7 KB

A "simple" bash script (created to learn a bit more bash scripting) that configures ssh port forwarding to access a remote host

License: MIT License

Shell 100.00%
ssh bash shell shell-script over-engineering winter2017

ssh-port-forward's Introduction

Bash script to setup SSH Port Forwarding
Perfect for creating Bash/ZSH/*SH aliases around

Usage: ssh-port-forward <forward_name> <local_port> <forwarded_host> <forwarded_port>
                        <ssh_host>

ssh-port-forward options
    -b <forward_name>      Opens the specified forward in the default browser
    -h                      Prints this help message
    -k <forward_name>       Closes the forward by the specified name
    -l                      Lists all currently forwarded ports

ssh options
    -i <identity_file>      Specify ssh keyfile to use for authentication
    -p <ssh_port>           Specify a port that the ssh server is running on

Browser options
    -s                      Specify whether to use SSL/TLS when opening in the browser
    -t                      Silent Mode: Does not open the link in the browser

When run, creates a $FORWARD_NAME-ssh.run file in /var/run/user/$UID/ssh-port-forward/ which contains the PID of ssh, the local port, remote host, and remote port.

If /var/run/user/$UID/ does not exist, script will exit 1


Features to add:
	- Saving of PID to allow easy exiting (with a --exit or --kill flag) [x] Added
	- Add configurable temp directory


Thanks to:
	- https://ryanstutorials.net/bash-scripting-tutorial/bash-functions.php for showing me the syntax for functions (and making quips about their use of paraenthesis)
	- http://tldp.org/LDP/abs/html/complexfunct.html for bash function tips
	- http://tldp.org/LDP/abs/html/fto.html for testing file / folder / socket existence
	- http://tldp.org/* at this point for teaching me everything
	- https://gist.github.com/scy/6781836 for some intersting ssh backgrounding information that I did not make use of
	- first comment at $ABOVE for linking me to $BELOW
	- second comment at https://stackoverflow.com/questions/2241063/bash-script-to-setup-a-temporary-ssh-tunnel/15198031#15198031 for introducing me to ssh control sockets (which are super cool)
	- the colorado school of mines for breaking me so much that after finished finals all I wanted to do is create more work for myself
	- people on stack overflow for teaching me bash scripting (and everything else I know)
	- the maker of the statue of liberty for being french
	- the dinosaur on the Firefox "Unable to connect" page for being cute the *-thousand time I forgot how to script
	- madeon for creating music to accompany me

ssh-port-forward's People

Contributors

robozman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  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.