Install SSH server on Tizen 2.3.1 for RD-PQ

December 8, 2015    Article    504 words    3 mins read

Check out the date on this baby!!

This content was originally published a while ago and could be quite outdated.

If you followed the instructions outlined in the first article, you are still limited by the USB cable and the sdb utility if you want to connect to your phone, so let’s install OpenSSH server so that we can connect remotely into it. You are supposed to be already connected via a WiFi network on your phone, if not, check out the previous article.

With Tizen, there is no such thing as easy-mode. There is no openssh rpm package in the 2.3.1 repository, so we have to go back to the 2.3 one and pull the required packages. Download the rpm and install it into your phone:

sdb root on
sdb push openssh-server-5.3p1-1.2.armv7l.rpm /home
sdb shell
$ rpm -ivh /home/openssh-server-5.3p1-1.2.armv7l.rpm --force --nodeps

if you try to start the SSH server now, either via service ssh start or systemctl start sshd, surprise, it won’t work. First option won’t work because there is no init script for sshd inside /etc/init.d and both won’t work because the ssh host keys aren’t setup automatically by the package, due to a missing binary from the rpm. So, let’s do that manually:

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /etc/ssh/ssh_host_rsa_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa): /etc/ssh/ssh_host_dsa_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.

When asked where to save the two keys, make sure you fill the correct path and file name, /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key. Also, put the code below inside a sshd.service file.

[Unit]
Description=SSHD server Daemon
After=syslog.target network.target
Requires=connman.service

[Service]
ExecStartPre=/bin/mkdir -p /var/run/sshd
ExecStart=/usr/sbin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Again, this systemd unit is chained correctly to start after conman, that starts after wlan-1 and wlan-2. Install the unit file into your phone, enable and start it.

sdb root on
sdb push sshd.service /etc/systemd/system/
sdb shell
$ systemctl enable sshd
$ systemctl start sshd

The OpenSSH server should start and run correctly now. You can check the IP address to which you need to connect from the ifconfig command.

# ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.0.9  netmask 255.255.255.0  broadcast 192.168.0.255

Fire up your favorite SSH client and connect to that IP, username is root, there is no password and you should be greeted by Tizen OS. If you issue a uname command, you should see something similar to this:

# uname -a
Linux TRATS2 3.0.101-trats2_defconfig #1-Tizen SMP PREEMPT Mon Sep 21 04:09:05 UTC 2015 armv7l GNU/Linux

If you want to check out the process list, you will notice lots of unneeded junk (well, needed for a phone, not for a home development server, and that’s what your RD-PQ is going to be. And we’ll do that in the next article.