• Install necessary packages.

  • Set PasswordAuthentication and KbdInteractiveAuthentication to no on /data/data/com.termux/files/usr/etc/ssh/sshd_config.

  • Add SSH public key to /data/data/com.termux/files/home/.ssh/authorized_keys.

    pkg install root-repo && pkg install sudo zsh git chezmoi tmux && \\
    rm ../usr/etc/tmux.conf && touch ../usr/etc/tmux.conf && \\
    nano ../usr/etc/ssh/sshd_config && \\
    nano .ssh/authorized_keys
    
  • Install my terminal setup for termux app and root user.

    sh -c "$(curl -fsSL <https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh>)"
    
    git clone <https://github.com/zsh-users/zsh-autosuggestions> ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \\
    git clone <https://github.com/zsh-users/zsh-completions> ~/.oh-my-zsh/custom/plugins/zsh-completions && \\
    git clone <https://github.com/zsh-users/zsh-syntax-highlighting> ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \\
    chezmoi init --apply arinc9
    
    sudo zsh
    
    ZSH="$HOME/.oh-my-zsh" sh -c "$(curl -fsSL <https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh>)"
    
    git clone <https://github.com/zsh-users/zsh-autosuggestions> ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \\
    git clone <https://github.com/zsh-users/zsh-completions> ~/.oh-my-zsh/custom/plugins/zsh-completions && \\
    git clone <https://github.com/zsh-users/zsh-syntax-highlighting> ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \\
    chezmoi init --apply arinc9
    
  • Follow the steps and use the script below for ~/.termux/boot/start-sshd.

    Termux:Boot - Termux Wiki

    #!/data/data/com.termux/files/usr/bin/sh
    sshd -D
    
    • Details on ssh -D as a workaround.

      [Bug]: Termux service stops if there's no Termux notification, breaks sshd · Issue #4657 · termux/termux-app