Skip to content

Commit be6374f

Browse files
committed
Science Commit 5.
1 parent e908ecb commit be6374f

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

modules/black/presidential/Brarner.M.Alete/install/deploy-remote-linux.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,18 @@ fi
6161
# Try SSH with accept-new for first-time key handshake
6262
if ! ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o BatchMode=yes "$REMOTE_USER@$REMOTE_HOST" "echo OK" 2>/dev/null; then
6363
echo "[!] SSH key not accepted. Attempting initial key exchange..."
64+
# Generate keypair if none exists
65+
if [ ! -f ~/.ssh/id_rsa ] && [ ! -f ~/.ssh/id_ed25519 ]; then
66+
echo "[*] No SSH key found — generating ed25519 keypair..."
67+
mkdir -p ~/.ssh && chmod 700 ~/.ssh
68+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -q
69+
fi
6470
if [ -t 0 ]; then
6571
ssh-copy-id -o ConnectTimeout=10 "$REMOTE_USER@$REMOTE_HOST" 2>/dev/null && \
6672
echo "[*] Key installed successfully" || \
6773
{ echo "[!] Key install failed. Try: ssh-copy-id ${REMOTE_USER}@${REMOTE_HOST}"; exit 1; }
6874
else
69-
echo "[!] Cannot SSH (no key, non-interactive). Run: ssh-copy-id ${REMOTE_USER}@${REMOTE_HOST}"
75+
echo "[!] Cannot SSH (non-interactive). Run: ssh-keygen -t ed25519 && ssh-copy-id ${REMOTE_USER}@${REMOTE_HOST}"
7076
exit 1
7177
fi
7278
fi

modules/black/presidential/Brarner.M.Alete/install/install.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,19 @@ if [[ "$CONFIRM" =~ ^[Yy]$ ]]; then
182182
elif ! ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o BatchMode=yes "$REMOTE_USER@$REMOTE_HOST" "echo OK" 2>/dev/null; then
183183
# BatchMode fails if no key — try interactive key setup
184184
echo "[!] SSH key not accepted. Attempting initial key exchange..."
185+
# Generate keypair if none exists
186+
if [ ! -f ~/.ssh/id_rsa ] && [ ! -f ~/.ssh/id_ed25519 ]; then
187+
echo "[*] No SSH key found — generating ed25519 keypair..."
188+
mkdir -p ~/.ssh && chmod 700 ~/.ssh
189+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -q
190+
fi
185191
if [ -t 0 ]; then
186192
ssh-copy-id -o ConnectTimeout=10 "$REMOTE_USER@$REMOTE_HOST" 2>/dev/null && \
187193
echo "[*] Key installed successfully" || \
188194
echo "[!] Key install failed. Try manually: ssh-copy-id ${REMOTE_USER}@${REMOTE_HOST}"
189195
else
190-
echo "[!] Cannot SSH to ${REMOTE_HOST} (no key, non-interactive)."
191-
echo " Run manually: ssh-copy-id ${REMOTE_USER}@${REMOTE_HOST}"
196+
echo "[!] Cannot SSH to ${REMOTE_HOST} (non-interactive)."
197+
echo " Run: ssh-keygen -t ed25519 && ssh-copy-id ${REMOTE_USER}@${REMOTE_HOST}"
192198
fi
193199
else
194200
# Check existing alias config

0 commit comments

Comments
 (0)