From ca40c8bdd0cb3262eb588edd828ed4a69d3bce80 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 23 Jul 2024 18:27:10 -0400 Subject: [PATCH] Improved convert to server script. --- .includes/convert-to-server.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.includes/convert-to-server.sh b/.includes/convert-to-server.sh index 8ebc4e1..1b7cfd4 100755 --- a/.includes/convert-to-server.sh +++ b/.includes/convert-to-server.sh @@ -19,8 +19,15 @@ dialog --backtitle "Configure Stormux" \ dialog --backtitle "Configure Stormux" \ --msgbox "Now let's upload your ssh key. It is a good idea to go ahead and connect via ssh now, in case something goes wrong you will have a chance to fix it manually. This will be used to login to your server, so whatever you do, don't lose it. If you have not yet created an ssh key, you can do so with the ssh-keygen command. Magic-wormhole will be used to upload the key. if you are doing this from a Windows based ssh session, you can install magic-wormhole with scoop: https://github.com/ScoopInstaller/Scoop" -1 -1 --stdout mkdir -p ~/.ssh -wormhole ssh invite +if [[ -e ~/.ssh/known_hosts ]]; then + dialog --backtitle "Configure Stormux" \ + --msgbox "Key found in ~/.ssh/known_hosts. If you are sure this is the correct key, press enter, otherwise press control+c to close this application and fix your key." -1 -1 --stdout +else + wormhole ssh invite +fi if ! [[ -e ~/.ssh/authorized_keys ]]; then + dialog --backtitle "Configure Stormux" \ + --msgbox "No ssh key found, exiting." -1 -1 --stdout exit 1 fi sudo sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/ssh/sshd_config