Giter Site home page Giter Site logo

robomfeinberg / labtunnel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from renxida/labtunnel

1.0 0.0 0.0 4 KB

Manage ssh tunnels with systemd. Most useful when you neet to maintain an always-up connection to a lab/work computer.

Shell 100.00%

labtunnel's Introduction

SSH Tunnel For SystemD

This systemd unit maintains an SSH tunnel of your choice. No root required.

Install

A systemd unit template file needs to be installed in order to run tunnels.

Running install.sh copies [email protected] to your ~/.config/systemd/user . Do not use sudo.

Read man systemd.unit for more information on templates.

Defining Tunnels

To define a tunnel, add the following lines to your ~/.ssh/config:

Host [Your tunnel name]
    HostName [ip or url to remote computer]
    Port     [ssh port, usually 22]
    User     xren
    IdentityFile ~/.ssh/zlab.key
    LocalForward [local port to access your tunnel] localhost:[remote port you want to connect to]

Read man ssh_config for more info.

Running Tunnels

To start your tunnel, substitute the tunnel name you defined into the following command: systemctl --user start labtunnel@[your tunnel name]

To set-up autostart, use the same command but replace start with enable: systemctl --user start labtunnel@[your tunnel name]

See more at man systemctl

Uninstalling

Run uninstall.sh from the project directory. The script removes autostart tunnels and the installed systemd template file.

After uninstalling, if you don't delete the lines you added to your ssh config, you may still runn ssh [your tunnel name] to access the tunnels manually.

Source

This project is based off drmalex07's systemd ssh tunneler at https://gist.github.com/drmalex07/c0f9304deea566842490.

My improvements include:

  • No priviledges required: everything is installed in ~/.config/systemd/user
  • Install/uninstall scripts
  • Usses ssh_config: can define all sorts of ssh connections, not just local tunnels

labtunnel's People

Contributors

renxida avatar mrkeuz avatar

Stargazers

Matthew Feinberg 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.