Connecting to Debian
table of contents
Now that we have installed a very basic Debian system on our phones, we can build up the environment into a useful workspace. Our first task will be to install an SSH server so that we can interact with the phone and its file system over a network. We will also install both an VNC server and the LXDE desktop, so that we can interact with the phone in "desktop mode" over a network.
sudo and SSH
Open ConnectBot, go to the protocol menu and select "local." Make up a name for the connection (e.g. "local shell") and you'll enter an Android shell. You can reach the same shell from your desktop computer (by using "adb shell"), but use ConnectBot for the next steps.
From the Android shell, we'll install sudo and the OpenSSH server, so that we can login to Debian via SSH. To gain root privileges, we will use sudo.
For the purposes of this guide, we'll create a user "soul." Replace that username with whatever you like.
a$ deb root
d# adduser soul
d# apt-get install sudo openssh-server
d# apt-get clean
d# adduser soul sudo
Now, start the OpenSSH server, by running:
a$ deb s
To stop the OpenSSH server later, run the deb S command. Note that toggling the case (i.e. between s and S) starts and stops the OpenSSH server.
Now, exit out of the Android shell:
Go back to the ConnectBot home screen, select "ssh" from the protocol menu and type "email@example.com" (replacing "soul" with the username you created earlier). That will launch a connection to a Debian shell. Enter the password that you made up previously and begin exploring.
In the meantime, you should tighten the security of your SSH installation by restricting the "ListenAddress" (IP addresses that SSHD will accept a connection from). For example, to only accept connections from localhost (the device itself) and from "192.168.0.101" (a hypothetical static IP on your home network), add:
to Debian's /etc/ssh/sshd_config file by using the nano editor:
d$ sudo nano /etc/ssh/sshd_config
LXDE over VNC
For a simple desktop, we'll install LXDE and access that desktop over VNC:
d$ sudo su
d# apt-get install lxde-core tightvncserver xfonts-base
d# apt-get clean
The "lxde-core" package installs a minimal LXDE desktop, while the "tightvncserver" package provides the VNC server that delivers the LXDE desktop to your Android screen or your computer screen.
So let's go check out our new desktop. First, we start the VNC server:
d$ tightvncserver -localhost :1 -geometry 800x480
Now, open the androidVNC app and add a new connection. The address is "localhost", the port is 5901 and the password is whatever you created earlier. After entering that information, press "Connect" to start your desktop session.
A script to start and stop VNC sessions is included in the /usr/local/bin scripts for d4cm. Using the vdesk script we can start and stop the VNC session by running:
d$ vdesk start
d$ vdesk stop
Copyright © 2014-2022 Eryk Wdowiak