26 lines
603 B
Bash
Executable File
26 lines
603 B
Bash
Executable File
#! /bin/sh
|
|
|
|
# Run the following command to install the public key to the authorized_keys file:
|
|
# /bin/bash -c "$(curl -fsSL https://git.trtmn.io/trtmn/public-key/raw/branch/main/key_install.sh)"
|
|
|
|
|
|
|
|
# Check for .ssh directory
|
|
if [ ! -d ~/.ssh ]; then
|
|
mkdir ~/.ssh
|
|
chmod 700 ~/.ssh
|
|
fi
|
|
|
|
# Check for authorized_keys file
|
|
if [ ! -f ~/.ssh/authorized_keys ]; then
|
|
touch ~/.ssh/authorized_keys
|
|
chmod 600 ~/.ssh/authorized_keys
|
|
fi
|
|
|
|
# Add public key to authorized_keys file
|
|
echo "$(curl https://git.trtmn.io/trtmn/public-key/raw/branch/main/id_rsa.pub)" >> ~/.ssh/authorized_keys
|
|
|
|
|
|
# Exit
|
|
exit 0
|