#!/bin/sh # archsshd # Craig Jennings # Sets up keys and sshd daemon on arch live cd check_root_or_exit () { if [ "$EUID" -ne 0 ] then echo "Please run as root" exit fi } retrieve_keys() { # retrieve keys from repo and decrypt echo "retrieving keys for decryption..." { mkdir -p "$HOME/.ssh/" # retrieve keys from dotfiles repo and decrypt the keys (git clone --depth 1 https://git.cjennings.net/dotfiles.git \ "$HOME/dotfiles/") >> /dev/null sleep 2 cp "$HOME/dotfiles/system/.ssh/"* "$HOME/.ssh/" } > /dev/null cd "$HOME/.ssh/" && gpg --decrypt "$HOME/ssh.tar.gz.gpg" | tar -zxf - # set proper permissions on .ssh directory cd "$HOME" && chmod 600 $HOME/.ssh/* && chmod 700 $HOME/.ssh \ && chmod 644 $HOME/.ssh/*.pub } setup_ssh () { # setup ssh echo "setting up ssh daemon..." systemctl start sshd echo "root:welcome" | chpasswd hostname=$(