Configuration SSH

VérifiéPrudence

Automatise la configuration de l'authentification par clé SSH sur un serveur distant. Vérifie la présence d'une paire de clés locale, en génère une si nécessaire, et copie la clé publique sur l'hôte distant. Utilisez cette compétence pour activer la connexion sans mot de passe à un serveur distant.

Spar Skills Guide Bot
DeveloppementIntermédiaire
6002/06/2026
Claude CodeCursorWindsurf
#ssh#key-authentication#remote-setup#password-less-login

Recommandé pour

Notre avis

Automatise la configuration de l'authentification par clé SSH sur un serveur distant en copiant la clé publique locale.

Points forts

  • Génère une paire de clés si nécessaire
  • Déploie la clé sur le serveur distant sans intervention manuelle
  • Vérifie la connexion après configuration

Limites

  • Nécessite que le serveur distant accepte les connexions SSH
  • Le mot de passe du serveur distant est requis pour la première copie
  • La génération de clé sans phrase de passe peut réduire la sécurité
Quand l'utiliser

Quand vous voulez activer l'accès SSH sans mot de passe pour un serveur distant.

Quand l'éviter

Si vous préférez une méthode plus sécurisée avec phrase de passe ou si le serveur ne supporte pas les clés publiques.

Analyse de sécurité

Prudence
Score qualité85/100

The skill automates SSH key setup, a legitimate task, but it relies on shell commands and an external script that is not audited in this submission. The no-passphrase key generation and bypass of execution policy increase risk.

Points d'attention
  • Uses run_shell_command to execute an external PowerShell script (scripts/deploy_key.ps1) with -ExecutionPolicy Bypass, which could be harmful if the script is compromised.
  • Generates SSH keys with no passphrase by default, reducing security.

Exemples

Enable SSH without password
Set up SSH key authentication for my remote server at 192.168.1.100 as user admin.
Generate and deploy SSH key
I need to copy my SSH public key to a remote host. Check if I have one and if not, generate it, then deploy it to root@example.com port 2222.
Fix password prompt on SSH
I keep getting prompted for a password when SSHing into my server. Automate the setup of key-based authentication.

name: ssh-setup description: Automates the process of setting up SSH key-based authentication on a remote server. Use this skill when the user wants to copy their local public key to a remote host to enable password-less login.

SSH Setup

Overview

This skill helps configure SSH key-based authentication. It handles:

  1. Checking for an existing local SSH key pair.
  2. Generating a new key pair if none exists.
  3. Copying the public key to a specified remote host.

Instructions

  1. Check for Local Key:

    • Look for SSH keys in the user's .ssh directory (e.g., ~/.ssh/id_ed25519.pub or ~/.ssh/id_rsa.pub).
    • Action: Check if the file exists using your file tools.
    • If no key is found:
      • Ask the user if they want to generate one.
      • If yes, use run_shell_command to generate it: ssh-keygen -t ed25519 -f "$env:USERPROFILE\.ssh\id_ed25519" -N "" (Note: This creates a key with NO passphrase for convenience. Ask the user if they prefer a passphrase).
  2. Get Remote Details:

    • Ask the user for the username and hostname (or IP) of the remote server.
    • Ask for the port (default is 22).
  3. Deploy Public Key:

    • To copy the key, you need to append the local public key content to the remote ~/.ssh/authorized_keys file.
    • Method A (PowerShell Script):
      • Use the bundled script scripts/deploy_key.ps1.
      • Command: powershell -ExecutionPolicy Bypass -File "scripts/deploy_key.ps1" -User <username> -HostName <hostname> -Port <port> -PubFile <path_to_pub_key>
    • Method B (Manual Command Construction):
      • If the script fails or you prefer to show the user the command:
      • Construct the command: Get-Content <pub_key_path> | ssh <user>@<host> "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
      • Important: This step will require the user's password for the remote server. The ssh command will prompt for it.
    • Action: Run the command. If it hangs waiting for input (password), you may need to instruct the user to run it themselves in their terminal.
  4. Verify:

    • Ask the user to verify login by running: ssh <user>@<host>
Skills similaires