[Android Software Development] E:V:A:
SSHelper (The free Android SSH Server Application)

Date: 2014-06-02

Difficulty: Easy

This is the XDA SSHelper support thread for the only completely open

source, transparent, free and ad-less SSH daemon/server Application for

Android. Sure there are plenty other Android SSH server apps out there, but

you can try to find one that is both free, without any ads, where all

the sources are clearly available and documented, where their developer

can be reached and contacted, and that has its own website.

To make things even better, I decided to start this thread in honor of,

and with permission by the main developer and scientist, Paul Lutus.

He's been developing software for NASA since the 80's and wrote one of

the first word processors for Apple-I. You can read all about it on his

website.

Another important reason for this thread is that SSHelper was developed

under CyanogenMod which is an AOSP ROM. This may cause many unexpected

side effects since those devices behave very differently from stock

(out-of-the-box) firmwares. While AOSP ROM often adds many new features,

they also remove many other OEM features that are mostly unknown or not

understood by the ROM builders/developers. So basing your app

development on a custom ROM is really begging for support trouble. This

will become even more apparent with the recent moves by Godzilla to make

AOS SELinux Enforced by default.

If you just need an SSH server right away, you can download the APK

directly from his website HERE or indirectly from Google Play.

The minimum required AOS is Honeycomb 3.2 / API 13, and the

current version is: 6.3 (04.28.2014).

SSHelper Features

SSHelper is much more than just an SSH server, it also offers:

full Rsync support

full sshd_config file support

full shell profile support

HTTP server

SCP server

SFTP server

Detailed Debug info (via App and web server)

Detailed Logcat view

Terminal Shell with OTG keyboard

and a full Busybox implementation

The Support

However, as you can imagine, the more supported features, the more

potential for problems. As the developer is a wild-life adventurer he's

not constantly sitting in front of his computer waiting to solve other

peoples problems, but often extremely isolated in the Alaskan wilderness

or in a small boat in the middle of the pacific.

That's why we need this thread. Other users may be able to help you if

they have had similar or previous problems. And if those problems aren't

solvable here, hopefully Paul will be able to have an occasional look,

insight and update.

However, since this application is based on OpenSSL / OpenSSH and so on,

the best place to find solutions and ask general SSH related questions

is on any of the 5 StackExchange related Q&A sites:

http://stackoverflow.com/

http://android.stackexchange.com/

http://unix.stackexchange.com/

http://serverfault.com/

http://superuser.com/

You should also have a good read at the SSHelper main support site.

So before posting here, search there first!

Required Android Permissions

( in: ../SSHelper/AndroidManifest.xml )

[SIZE=2]android.permission.ACCESS_NETWORK_STATE[/SIZE]
[SIZE=2]android.permission.ACCESS_SUPERUSER[/SIZE]
[SIZE=2]android.permission.ACCESS_WIFI_STATE[/SIZE]
[SIZE=2]android.permission.BLUETOOTH[/SIZE]
[SIZE=2]android.permission.CHANGE_WIFI_MULTICAST_STATE[/SIZE]
[SIZE=2]android.permission.CHANGE_WIFI_STATE[/SIZE]
[SIZE=2]android.permission.INTERNET[/SIZE]
[SIZE=2]android.permission.RECEIVE_BOOT_COMPLETED[/SIZE]
[SIZE=2]android.permission.WRITE_EXTERNAL_STORAGE[/SIZE]

These will probably need to be updated in order to solve some issues

when used on devices running SEAndoid in Enforced mode.

Application File Locations

All the SSHelper related files are located in and below the base directory at:

/data/data/com.arachnoid.sshelper

[SIZE=2]bin Here are all the binary assets, such as busybox and sshd etc.[/SIZE]
[SIZE=2]cache [/SIZE]
[SIZE=2]databases [/SIZE]
[SIZE=2]dev [/SIZE]
[SIZE=2]etc [/SIZE]
[SIZE=2]files [/SIZE]
[SIZE=2]home Your home directory when using SSH[/SIZE]
[SIZE=2]lib Symlinked to: /data/app-lib/com.arachnoid.sshelper-1[/SIZE]
[SIZE=2]tmp [/SIZE]
[SIZE=2]var [/SIZE]

The APK Assets

[SIZE=2]busybox_gz[/SIZE]
[SIZE=2]rsync_gz[/SIZE]
[SIZE=2]scp_gz[/SIZE]
[SIZE=2]sftp_gz[/SIZE]
[SIZE=2]ssh_gz[/SIZE]
[SIZE=2]ssh_keygen_gz[/SIZE]
[SIZE=2]ssh_keyscan_gz[/SIZE]
[SIZE=2]sshd_gz[/SIZE]
[SIZE=2]favicon.ico[/SIZE]
[SIZE=2]profile[/SIZE]
[SIZE=2]server_page.html[/SIZE]
[SIZE=2]sshd_config[/SIZE]

Installed Binaries

From Busybox we have:

[SIZE=2]BusyBox v1.21.0 (2014-04-01 22:29:02 PDT) multi-call binary.[/SIZE]
[SIZE=2]BusyBox is copyrighted by many authors between 1998-2012.[/SIZE]
[SIZE=2]Licensed under GPLv2. See source distribution for detailed[/SIZE]
[SIZE=2]copyright notices.[/SIZE]

[SIZE=2]Usage: busybox [function [arguments]...][/SIZE]
[SIZE=2] or: busybox --list[-full][/SIZE]
[SIZE=2] or: busybox --install [-s] [DIR][/SIZE]
[SIZE=2] or: function [arguments]...[/SIZE]

[SIZE=2] BusyBox is a multi-call binary that combines many common Unix[/SIZE]
[SIZE=2] utilities into a single executable. Most people will create a[/SIZE]
[SIZE=2] link to busybox for each function they wish to use and BusyBox[/SIZE]
[SIZE=2] will act like whatever it was invoked as.[/SIZE]

[SIZE=2]Currently defined functions:[/SIZE]
[SIZE=2] [, [[, ar, arp, ash, awk, base64, basename, bbconfig, beep, blkid,[/SIZE]
[SIZE=2] blockdev, bootchartd, bunzip2, bzcat, bzip2, cal, cat, catv, chat,[/SIZE]
[SIZE=2] chattr, chgrp, chmod, chown, chpst, chroot, chrt, chvt, cksum, clear,[/SIZE]
[SIZE=2] cmp, comm, cp, cpio, crond, crontab, cttyhack, cut, dc, dd, deallocvt,[/SIZE]
[SIZE=2] depmod, devmem, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix,[/SIZE]
[SIZE=2] dpkg, dpkg-deb, du, dumpkmap, echo, ed, egrep, env, envdir, envuidgid,[/SIZE]
[SIZE=2] expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat,[/SIZE]
[SIZE=2] fdisk, fgconsole, fgrep, find, findfs, flash_lock, flash_unlock,[/SIZE]
[SIZE=2] flashcp, flock, fold, free, freeramdisk, fsync, ftpd, ftpget, ftpput,[/SIZE]
[SIZE=2] fuser, getopt, grep, gunzip, gzip, halt, hd, hdparm, head, hexdump,[/SIZE]
[SIZE=2] hostname, httpd, hwclock, ifconfig, ifdown, ifup, init, inotifyd,[/SIZE]
[SIZE=2] insmod, install, iostat, ip, ipaddr, ipcalc, iplink, iproute, iprule,[/SIZE]
[SIZE=2] iptunnel, klogd, less, linuxrc, ln, loadkmap, losetup, lpd, lpq, lpr,[/SIZE]
[SIZE=2] ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat,[/SIZE]
[SIZE=2] makedevs, makemime, man, md5sum, mdev, mesg, mkdir, mkfifo, mknod,[/SIZE]
[SIZE=2] mkswap, mktemp, modinfo, modprobe, more, mpstat, mv, nbd-client, nc,[/SIZE]
[SIZE=2] netstat, nice, nmeter, nohup, od, openvt, patch, pidof, ping,[/SIZE]
[SIZE=2] pipe_progress, pmap, popmaildir, poweroff, powertop, printenv, printf,[/SIZE]
[SIZE=2] ps, pscan, pstree, pwd, pwdx, raidautorun, rdev, readlink, readprofile,[/SIZE]
[SIZE=2] realpath, reboot, reformime, renice, reset, resize, rev, rm, rmdir,[/SIZE]
[SIZE=2] rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runsv, runsvdir, rx,[/SIZE]
[SIZE=2] script, scriptreplay, sed, sendmail, seq, setconsole, setkeycodes,[/SIZE]
[SIZE=2] setlogcons, setserial, setsid, setuidgid, sha1sum, sha256sum, sha3sum,[/SIZE]
[SIZE=2] sha512sum, showkey, sleep, smemcap, softlimit, sort, split,[/SIZE]
[SIZE=2] start-stop-daemon, strings, stty, sum, sv, svlogd, switch_root, sync,[/SIZE]
[SIZE=2] sysctl, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp,[/SIZE]
[SIZE=2] tftpd, time, timeout, top, touch, tr, traceroute, true, ttysize,[/SIZE]
[SIZE=2] tunctl, tune2fs, udpsvd, uname, uncompress, unexpand, uniq, unix2dos,[/SIZE]
[SIZE=2] unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode, uuencode,[/SIZE]
[SIZE=2] vconfig, vi, volname, watch, wc, wget, which, whoami, whois, xargs, xz,[/SIZE]
[SIZE=2] xzcat, yes, zcat[/SIZE]

In addition to that, in the $SSHELPER/bin we find:

[SIZE=2]rsync[/SIZE]
[SIZE=2]scp[/SIZE]
[SIZE=2]sftp[/SIZE]
[SIZE=2]ssh[/SIZE]
[SIZE=2]ssh-keygen[/SIZE]
[SIZE=2]ssh-keyscan[/SIZE]
[SIZE=2]sshelper_sshd[/SIZE]

References and Resources:

<WIP>

​