tldr: scroll down to Setup of SSH on LineageOS.
I strongly discourage everyone from buying a ShiftPhone. The Phone was/is on Android patch level from 2017-03-05 – which is one and a half year ago! Not to mention that it was running an Android 5.1.1 in 2018… With soo many bugs and security issues, in my opinion this phone is a danger to the community! And nobody at Shift seemed to really care…
Next, I’d like to have SSH access to the phone. I did love the native SSH server on my Galaxy S2, which used to run CyanogenMod for 5+ years. Using the SSH access I was able to integrate it in my backup infrastructure and it was much easier to quickly copy stuff from the phone w/o a cable :)
The original webpage including a how-to for installing SSH on CyanogenMod has unfortunately vanished. There is a copy available from the WayBackMachine (thanks a lot guys!!). I still thought dumping an up-to-date step-wise instruction here may be a good idea :)
Setup of SSH on LineageOS
The setup of the native SSH server on LineageOS seems to be pretty similiar to the CyanogenMod version. First you need a shell on the phone, e.g. through adb, and become root (su). Then just follow the following three steps:
Create SSH daemon configuration
You do not need to create a configuration file from scratch, you can use
/system/etc/ssh/sshd_config as a template.
Just copy the configuration file to
Just make sure you set the following things:
Subsystem sftp internal-sftp
Setup SSH keys
First, we need to create
/data/.ssh on the phone (note the
.!) and give it to the
Second, we need to store our public SSH key (probably stored in
~/.ssh/id_rsa.pub on your local machine) in
/data/.ssh/authorized_keys on the phone.
If that file exists, just append your public key into a new line.
Afterwards, handover the
authorized_keys file to the shell user:
Create a start script
Last but not least, we need a script to start the SSH service.
There is again a template available in
Just copy the script to
Finally, we just need to update the location of the
/data/ssh/sshd_config in our newly created
/data/local/userinit.d/99sshd script (in the template it points to
/system/etc/ssh/sshd_config, there are 2 occurences: for running the daemon w/ and w/o debugging).
You can now run
/data/local/userinit.d/99sshd and the SSH server should be up and running :)
Earlier versions of Android/CyanogenMod auto-started the scripts stored in
/data/local/userinit.d/ right after the boot, but this feature was removed with CM12..
Thus, at the moment it is not that easy to automatically start the SSH server with a reboot of your phone.
But having the SSH daemon running all the time may also be a bad idea, in terms of security and battery…
- network (64) ,
- software (148) ,
- security (28) ,
- administration (34) ,
- private (33) ,
- operatingsystem (14) ,
- howto (22) ,
- phone (5) ,
- cyanogen (4) ,
- lineageos (4)
- android (5) ,
- backup (5) ,
- config (15) ,
- cyanogen (4) ,
- lineageos (5) ,
- network (75) ,
- phone (5) ,
- private (29) ,
- remote (18) ,
- ssh (12) ,
- trick (56)