Web based SSH access to your Raspberry Pi


See here for Fedora instructions.

Using wssh, you can setup a web based SSH access mechanism to your Raspberry Pi. This looks more attractive when you expose your Pi using a public IP address/hostname using a service like Pagekite. Let us see how (I am assuming your Raspberry Pi is running raspbian).

Installing wssh

wssh has a bunch of dependencies which you can install with a mix of apt-get and easy_install. Note that we will be using the in built wssh server, ‘wsshd’ which uses Flask for the Web application, hence we install Flask as well.

Install the dependencies:

pi@raspberrypi ~ $ sudo apt-get install python-dev libevent-dev
pi@raspberrypi ~ $ sudo easy_install gevent flask paramiko gevent-websocket wssh

It will take some time for these to install and once they are completed, you should be able to start the wssh server. If you get a message like that, your server is up and running and you can visit the URL in your browser.

pi@raspberrypi ~ $ wsshd 
wsshd/0.1.0 running on 0.0.0.0:5000

You will be greeted with a login screen such as the one below:

Login Screen

Note that this server is running on your Raspberry Pi, and hence localhost means the Pi itself. (You can ofcourse use any other computer’s hostname or IP address on your network). If you have been logged in succesfully, you should see the shell:

Shell

And then you can do all you wish to right there in your browser.

Public facing hostname

Once you make the server reachable at a public facing hostname, things get really interesting since you can now access your Pi from anywhere in the world, literally. A service like Pagekite.net can help achieve that. Once you have installed Pagekite and signed up using your email address, you can start ‘wsshd’ as a background process and tell Pagekite to make the 5000 port available as your chosen kite name:

$ wsshd &
$ pagekite.py 5000 yourpi.pagekite.me

And you should have your SSH login screen at your chosen kitename: http://yourpi.pagekite.me in this case. And ofcourse, you can use the instructions here to set this up for any of your other computers running Linux.

About these ads

12 thoughts on “Web based SSH access to your Raspberry Pi

  1. Hey, i’ve followed this idea, I was wondering if this is possible with localtunnel as I don’t want to pay monthly for PageKite. I get the WSSH page up fine when it’s all up and running from another PC away from the local host, but it says Connectiong …….Connection rejected by peer. I know for certain it’s not a password issue as I can log in with the same creds on the local machine. Do you have any ideas? Thanks.

  2. Hi!
    I tried following the setup as explained in the post. I do see the message in the terminal “wsshd/0.1.0 running on 0.0.0.0:5000″ but do not see any login screen. Could you advise me on the possible cause for error. Thanks!

    • Ah! Sorry about the silly question, I didn’t notice the part that said “visit the url in a browser”. Thanks so much for the post :)

      • I use the Wheezy distro for Raspberry Pi. I created manually a service file in /etc/init.d/ like that:

        #! /bin/sh
        # /etc/init.d/wsshd
        # Carry out specific functions when asked to by the system
        case “$1″ in
        start)
        sudo wsshd&
        ;;
        stop)
        sudo kill $(ps aux | grep ‘wsshd’ | awk ‘{print $2}’)
        ;;
        *)
        echo “Usage: /etc/init.d/blah {start|stop}”
        exit 1
        ;;
        esac
        exit 0

        But this does not do the trick. I can start manually the service with “service wsshd start” but when I restart the raspberry, the service is not started.

        Thanks for help.

        Thomas

    • Hi Amit and thanks for the prompt answer, I would have it googled later on :)
      The command does work with some warnings:

      pi@waitforit ~ $ sudo update-rc.d wsshd defaults
      update-rc.d: using dependency based boot sequencing
      insserv: warning: script ‘wsshd’ missing LSB tags and overrides
      insserv: warning: script ‘pushover’ missing LSB tags and overrides

      Thank you very much ! Your help and posts are much appreciated !

    • It did actually ! Many thanks !
      Totally forgot that step. It works just fine.
      Just few annoying limitations from wsshd:
      - no copy/paste
      - no mouse selection
      - fixed sized window

      However, many thanks to the evil developers behind that. I can access my server from any device from anywhere. So convenient !

      Thanks for the great post.

      I propose you add the following instructions to run it as a service. It will help a lot of people.

      Cheers from France

  3. Hi, thank you for the post, it has been really useful!
    Do you know how I could acces the raspberry pi with a dynamic dns (I’m using no-ip.com) as a hostname?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s