How to enable SSH on UBPorts Ubuntu Touch?
#10
Ssh doesn't work on my pinephone if the root directory is readonly, so, I guess, it's necessary to remount it in rw mode.
I don't need the extra-secure mode, so I prefer to ssh with username password.
This is what I ended up with in the /etc/ssh folder using trial and error method:
ssh_config:
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
# GSSAPIAuthentication yes
# GSSAPIDelegateCredentials no

////////////////////ssh_config ends above

sshd_config:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
#PermitRootLogin prohibit-password
#StrictModes yes

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords yes

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication yes

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

////////////////////sshd_config ends above

You can edit/copy the files over by mounting the mmcblk*p09 partition while the OS is not booted, e. g. when the SD card is in your laptop, or when you boot from the SD card and mount the eMMC in while booted from the SD card.

Also, I found it more convenient to use ssh after reinstalling it (remount required):
sudo apt purge openssh-server
sudo apt install openssh-server

For CTRL key, check the actions available when you press the icon with three short parallel lines in the terminal, it's on the panel at the bottom of the terminal (and on top of the keyboard when it's active).
Cheers!

P. S. this will only work until the next reboot or ro mount, you will need to remount & restart ssh every time. I would recommend you to write an alias in your /etc/bash.bashrc file to save you some typing.


Messages In This Thread
RE: How to enable SSH on UBPorts Ubuntu Touch? - by afigegoznaet - 05-21-2020, 03:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Ubuntu Touch on Pine64 Rondarius 11 3,385 10-11-2023, 12:36 PM
Last Post: Rondarius
  Ubuntu Touch vs Standard Pinephone OS MarsColonist 8 5,731 06-26-2023, 07:50 AM
Last Post: gregb49
  Reinstall Ubuntu Touch on PinePhone with 10 drives? Peter Gamma 4 2,827 05-24-2022, 06:42 AM
Last Post: Peter Gamma
  PinePhone UBPorts Edition stuck on PINE64 logo screen Giovanni Iannotti 4 4,915 09-01-2021, 01:20 PM
Last Post: Giovanni Iannotti
  UB Touch build with debos layton-dev 0 2,238 04-23-2021, 08:12 AM
Last Post: layton-dev
  Ubuntu Touch with OTA updates Luke 131 166,015 04-21-2021, 12:20 PM
Last Post: Nooblife
  online accounts in UBports Uturn 2 4,183 03-30-2021, 09:12 AM
Last Post: Uturn
  UBPorts Not Working Pinoideae 7 9,612 03-13-2021, 01:51 PM
Last Post: KNERD
  Whats the latest with UB touch? Cree 9 11,267 03-11-2021, 10:59 AM
Last Post: andybleaden@gmail.com
  How to enable Ethernet with UBPorts and convergence dock? piney-tim 1 3,034 11-27-2020, 07:40 PM
Last Post: piney-tim

Forum Jump:


Users browsing this thread: 1 Guest(s)