Son aktivite 1760251296

Revizyon 00dab198edcd86257325d5f3ee3424b36707d39d

getpubkey.sh Ham
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
9pushd ~/.ssh/
10
11# Download the public key
12wget -q -O - "$KEY_URL" > ~/.ssh/authorized_keys
13
14# Set appropriate permissions for the authorized_keys file
15chmod 600 ~/.ssh/authorized_keys
16
17# Check if the .ssh directory exists and create it if it doesn't
18if [ ! -d ~/.ssh ]; then
19 mkdir -p ~/.ssh
20 chmod 700 ~/.ssh
21fi
22
23echo "Public key successfully added to authorized_keys"