Search This Blog

Dropbear SSH server on Android

It's safe to say that if you're reading this then you know why one would want an SSH server running on your Android device. Personally I have SSH running on all my Linux boxes because it makes life so much easier, and I'm sure I do not need to explain why. Having an SSH server start on boot is simply a lot more convenient!

There are a number of apps on the Android market but most of them are utterly useless with one exception: SSHDroid.

If you are likely to use SSH once in a while then it may be easier for you to just install SSHDroid on your device and start it when needed, and I have been happy with it for a while.

However:
  1. It's an ugly app that sits in your notification tray once it has been started and uses up RAM and CPU. I want a background app.
  2. SSHDroid refuses to run if it cannot access adverts unless you pay for it. I block all adverts because they get on my nerves.
  3. All it does is drop a copy of Dropbear anyway, so you may as well do that yourself.
  4. Dropbear will happily run in the background and uses tiny amounts of CPU when active, so you can imagine how little it does when idle.
  5. If you can compile Dropbear yourself you can choose the options that you want.
As I'm sure you are aware there is no package delivery system for this kind of application in Android, but Android runs on a modified Linux kernel - this makes things so much easier! The result being that the following process is ridiculously easy assuming that your OS has:
  • su or sudo (root)
  • init.d support (or another way to run scripts at startup)
The only problem, really, is that the filesystem and methods used in Android aren't exactly standard compared to other *nix systems, but its not massively different. The result being that there are a number of ways that you can get things to work, so I'll simply show you what I have done. If I was doing this to a number of devices or in a corporate environment then I would use a bit more planning.

YouTube is utterly broken

Google have recently made a whole bunch of changes across most of their platforms to, apparently, integrate more easily with Google+. One of the platforms affected is YouTube. But YouTube also decided to introduce a new video format at the same time, namely 140p (around 32kbps, presumably for dial-up users).

At the exact same time my ISP, O2, sold their broadband network to Sky, more's the pity. I have been informed that there should have been no changes to my ISP in any way... yet.

If that is the case then YouTube is definitely broken.

Nuisance 1
Connection: Ethernet --> ADSL2+

The first problem which became apparent was that the Wii client couldn't play videos any more, or not for more than a few seconds anyway. When it did play it would randomly stop to buffer only a few seconds at a time, and sometimes give up altogether and exit the video. I am not alone:
YouTube on Wii keeps buffering. It won't load more than 30 seconds of video.

Nuisance 2
Connection: Any

The second problem was on the trusty browser. In my case Chromium on Ubuntu 12.04.

I seem to have been volunteered to join the HTML5 trial, which I really didn't mind except that it doesn't bloody work.



The video above is Big Buck Bunny downloaded in H264 format at 1080p. It refuses to play in the HTML5 player. To be fair this has only been uploaded a few hours ago and may need time to prepare/transcode/whatever, but as a general rule the HTML5 player fails on videos a LOT.

Switching back to Flash for affected videos can still give the same message, but continually hitting refresh tends to get the damned thing working.

Nuisance 3
Connection: Any

Another problem is that the video will play for a few seconds, usually the magic number of 19 seconds, and then stop, never to continue. Hitting refresh a number of times is required for this to start working too. See the video in Nuisance 4 for an example of this.

Nuisance 4
Connection: Wi-Fi --> ADSL2+

With my 3Mbps down connection I have been able to play 720p YouTube videos for quite a while. If someone else is on the network then it would happily drop down to 480p and play nicely. Not any more!

For reasons unknown the quality jumps up and down, preferentially towards the new 144p format. This is simply ridiculous! At 144p some videos are nothing more than a jumble of pixels. I have deliberately chosen a picture slideshow to show this as quality should be easy to maintain (very little motion). The video is 1080p.



This video shows a typical example of what happens (approximate times):

0:00 "An error occurred, please try again".
0:27 480p
0:37 Video stops altogether as the download stream fails and there is not enough video buffered.
0:45 144p
0:55 480p
1:13 240p
1:45 360p
2:20 144p

Perhaps the ISP or the connection to the router is the problem? Well, I tested this by downloading Big Buck Bunny. This was over Wi-Fi. Caution: this is a very dull video.



tldw; The video basically shows a number of drops in download speed. If I was sensible I would compare this to a wired connection but I don't feel there is any point: the drop-outs are minimal and very short lived. The download (of Big Buck Bunny) is not affected. I also have no other problems with connection on this computer ever. I feel fairly safe to conclude that the signal is not the problem and given that YouTube is supposed to buffer to avoid these problems, that this is not the cause. Uploading is a very similar story. In this instance it's an upload to YouTube of Big Buck Bunny. An equally dull video.

Reported.

Nuisance 5
Connection: Wi-Fi --> Any

On mobile, the video usually plays quite well, but recently has decided to simply pause for no reason. Hitting play will start it up again but... Nuisance 6.

Not tested over a mobile network yet but I cannot imagine it makes a difference.

Reported.

Nuisance 6
Connection: Any

On both mobile and web the video should buffer. It doesn't really matter if it does, however. Once paused, either intentionally or because the mobile just felt like it, the video continues to buffer. When clicking play the entire buffer is lost and the video starts downloading again. What the Hell is the point in the video buffering if it's just going to dump the buffer anyway? A wonderful waste of bandwidth.

Pausing used to be useful if I wanted to buffer a whole video in 1080p and watch it in this higher quality. Now it is simply impossible!

The Android app has a solution: pre-loading. Add the video to "Watch later" and it will download the whole video. Annoyingly if you don't watch every video you have pre-loaded immediately then there is a notification on the phone "reminding" you that you have pre-loading enabled and you're not watching the videos. P.I.T.A.

Nuisance 7
Connection: Ethernet --> Powerline --> Ethernet --> ADSL2+

This has never worked. I have a Philips Blu-ray player which comes with a YouTube app (probably Java).

The problem being that the bloody stupid thing makes no attempt to discover the maximum download speed. This means that it will play at the highest quality, no matter what it is. At 3 Mbps my connection cannot handle 1080p (or in some cases 720p) and so continually stops, buffers a BIT (pausing is no use) and then goes through the process again. There is no solution. Even using the Android app the quality cannot be amended.



I thought this app may be maintained by Philips, but it has the same layout as other T.V. apps for YouTube so I don't know who maintains the code. Either way it's cack.

Reported.

Nuisance 8
Connection: Ethernet --> Powerline --> Ethernet --> ADSL2+

Same equipment as above. The Wii works fine using the Android app as a remote control. On the Blu-ray player it often does whatever the Hell it likes. It nearly always starts the video twice, sometimes three times, and often randomly switches the video. Sometimes it plays a video I played a while ago because it seems to have created a play list and decides to play that from the beginning. The whole thing is just garbage! The responsiveness is generally poor on the YouTube app on this Blu-ray player anyway. The Blu-ray player itself seems underpowered but it plays all kinds of HD files without any problem.

(The Picasa app cannot handle video at all, but makes no attempt to filter them.)

I'm sure there are more but I think I've said enough for now.

YouTube is utterly broken!
My profile on StackExchange