Code Monkey home page Code Monkey logo

one-liner-ssh-to-raspberry-pi's Introduction

one-liner-SSH-to-Raspberry-Pi

SSH into your Weaved connected Raspberry Pi with one command.

Adapted from userlogin and deviceconnect.

Screenshots

Installation

You must have a Weaved account and your Pi's SSH port connected and up with Weaved.

Clone this repo and cd into it:

$ wget https://raw.githubusercontent.com/ritiek/one-liner-SSH-to-Raspberry-Pi/master/sshpi.sh

Now just add your weaved email, pass and your pi's UID in sshpi.sh depending upon your preferred language.

You can find your UID by logging into Weaved and opening your SSH service, you will find a URL like https://developer.weaved.com/portal/members/viewerPage.php?id=00:00:00:01:00:00:A1:1A&type=00:1C:00:00:00:01:00:00:01:10:00:11:00:00:00:00&name=U1NIIFRlcm1pbmGd appear.

Here 00:00:00:01:00:00:A1:1A is your UID

Usage

Simply pass the bash script with -p option as hostname:

$ ssh pi@$(bash sshpi.sh -p)

It can also be used in other tools that require use of SSH like sshuttle that do not use the -p option.

$ sshuttle -r pi@$(bash sshpi.sh) 0.0.0.0/0

Options

The tool takes -p as optional parameter to generate the address by passing the port number to -p option:

$ sshpi -p
proxyaddress -p proxyport

without -p option:

$ sshpi
proxyaddress:proxyport

This option may be useful to you depending on how you want to pass the SSH address as different tools use one of it as a preference.

Add to PATH

You can copy this script to PATH, if you want a command named sshpi:

$ sudo cp sshpi.sh /usr/bin/sshpi
$ sudo chmod +x /usr/bin/sshpi

Then you can just do:

$ ssh pi@$(sshpi -p)

or

$ sshuttle -r pi@$(sshpi) 0.0.0.0/0

It will automatically SSH into your Pi after generating a token and fetching Weaved's forwarded SSH port.

How it works?

It just makes use of the Weaved API.

More info on their API here http://docs.weaved.com/.

License

The MIT License

one-liner-ssh-to-raspberry-pi's People

Contributors

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