31 lines
778 B
Bash
Executable File
31 lines
778 B
Bash
Executable File
#!/bin/bash
|
|
# Add your SSH public key to the Netcup server
|
|
# This requires password authentication once
|
|
|
|
SERVER="159.195.32.209"
|
|
USER="root"
|
|
KEY_FILE="$HOME/.ssh/netcup_ed25519.pub"
|
|
|
|
echo "Adding SSH key to Netcup server..."
|
|
echo "You will be prompted for the root password ONCE"
|
|
echo ""
|
|
|
|
# Copy SSH key to server
|
|
ssh-copy-id -i "$KEY_FILE" "${USER}@${SERVER}"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "✓ SSH key added successfully!"
|
|
echo "Testing connection..."
|
|
ssh -o ConnectTimeout=5 netcup "echo 'SSH key authentication working!'"
|
|
else
|
|
echo ""
|
|
echo "✗ Failed to add SSH key"
|
|
echo "You may need to:"
|
|
echo "1. Log into Netcup web console"
|
|
echo "2. Go to ~/.ssh/authorized_keys"
|
|
echo "3. Add this key:"
|
|
echo ""
|
|
cat "$KEY_FILE"
|
|
fi
|