Naposledy aktivní 1767374640

Revize 3c017098b5277170f44f80c389519d22e8138517

getpubkey.sh Raw
1#!/bin/bash
2
3# Prompt the user for their GitHub username
4read -p "Enter your GitHub username: " USERNAME
5
6# Get the GitHub public key URL
7KEY_URL="https://github.com/$USERNAME.keys"
8
9# Download the public key
10wget -q -O - "$KEY_URL" > ~/.ssh/authorized_keys
11
12# Set appropriate permissions for the authorized_keys file
13chmod 600 ~/.ssh/authorized_keys
14
15# Check if the .ssh directory exists and create it if it doesn't
16if [ ! -d ~/.ssh ]; then
17 mkdir -p ~/.ssh
18 chmod 700 ~/.ssh
19fi
20
21echo "Public key successfully added to authorized_keys"