From 26f3d9713e7924f19b8a6b5debd529a6da9e24e5 Mon Sep 17 00:00:00 2001 From: Raine Date: Mon, 30 Oct 2023 00:56:13 +0100 Subject: [PATCH] feat: setup-server from link --- tools/migration/initial-connection-to-server.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 tools/migration/initial-connection-to-server.sh diff --git a/tools/migration/initial-connection-to-server.sh b/tools/migration/initial-connection-to-server.sh new file mode 100755 index 0000000..b725ee3 --- /dev/null +++ b/tools/migration/initial-connection-to-server.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if ! [ "$(id -u)" = "0" ]; then + echo "please perform as root, attempting to escalate privileges..." + exec sudo $(cat /proc/$$/cmdline | sed 's/\x00/ /g') + exit 1 +fi + +scp \ + -i /etc/ixvd/secrets/ssh/keys/master/ixvd-master \ + /etc/ixvd/secrets/ssh/keys/master/ixvd-master \ + root@$1:.ssh/id_rsa + +ssh \ + -i /etc/ixvd/secrets/ssh/keys/master/ixvd-master \ + root@$1 \ + chmod 600 .ssh/id_rsa \ No newline at end of file