Created
July 15, 2025 04:02
-
-
Save isurfer21/202ea5ed4b149e4b8d08ea4847b13a40 to your computer and use it in GitHub Desktop.
Revisions
-
isurfer21 created this gist
Jul 15, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/bin/bash # Set the key file path KEY_PATH="$HOME/.ssh/id_rsa" # Check if the SSH key already exists if [ -f "$KEY_PATH.pub" ]; then echo "SSH key already exists at $KEY_PATH.pub" else echo "Generating a new SSH key..." ssh-keygen -t rsa -b 4096 -f "$KEY_PATH" -N "" echo "SSH key generated." fi # Display the public key echo "Your public SSH key is:" cat "$KEY_PATH.pub" # Optional: Copy to remote system (uncomment and edit the line below) # ssh-copy-id user@remote_host