ryanc410 / easy_ssh

SSH Login template script for easy SSH Authentication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub search hit counter GitHub Repo stars GitHub forks

easy_ssh



SSH LOGO

TABLE OF CONTENTS


  1. About this Project

  2. Setup Instructions


ABOUT


    This script was written to make Authenticating with a Remote Host as easy as one command. When you have multiple remote servers that you manage and each one has their own private key, it can become a hassle to manage all of them. Hopefully this script will help make managing those remote hosts and private keys easier.



SETUP


These instructions are just a recommendation of how you COULD set things up. You dont necessarily have to set things up this way for the script to function. This is how I configured the script on my system.


BEFORE DOING ANYTHING, ENSURE YOUR PRIVATE KEYS HAVE THE CORRECT PERMISSIONS. IF YOU DO NOT DO THIS YOU WILL GET AN ERROR SAYING YOUR KEY IS NOT SECURE AND THE KEY WILL BE REJECTED!

chmod 600 /path/to/keys/privatekey_rsa

CLONE THE REPOSITORY

cd ~
git clone https://github.com/ryanc410/easy_ssh.git

ADD THE easy_ssh DIRECTORY TO YOUR SYSTEM'S PATH SO YOU CAN EXECUTE THE SCRIPT FROM ANYWHERE.

export PATH="~/easy_ssh/:$PATH"

CD INTO THE easy_ssh DIRECTORY AND COPY THE ssh-login.sh SCRIPT TO A NAME OF YOUR REMOTE SERVER. THEN MAKE THE SCRIPT EXECUTABLE.

cd easy_ssh
cp ssh-login.sh DOMAIN.sh
chmod +x DOMAIN.sh

OPEN THE COPIED SCRIPT AND CHANGE THE VARIABLES JUST BELOW THE SCRIPT INFORMATION BOX TO THE VALUES THAT MATCH YOUR CONFIGURATION.

#!/usr/bin/env bash
########################################################
# AUTHOR: Ryan C. 
# GITHUB: https://github.com/ryanc410
# DATE: 02-17-2022
# DESCRIPTION: SSH login template for easy Authentication and management of Remote Hosts.
# VERSION: 1.0
########################################################

# Change this value to the IP address of the Remote Host you want to authenticate with.
IP=    <----REMOTE SERVER IP ADDRESS.
# The username to login to the Remote Host.
USER=    <----THE USERNAME TO LOGIN WITH.
# Path to the Private Key that matches the authorized_keys file on the Remote Host. If SSH keys are not configured leave blank.
KEY_FILE=    <----PATH TO WHERE YOU STORE YOUR PRIVATE KEYS. I USUALLY STORE MINE IN ~/.ssh TO MAKE IT EASIER TO REMEMBER.
# If a port other than 22 is configured in the sshd_config file on the Remote Host, enter it here. If not leave blank.
PORT=    <----IF YOU CHANGED THE SSH LISTEN PORT IN THE SSHD_CONFIG FILE PUT THE LISTEN PORT HERE.

EXECUTE THE SCRIPT!

DOMAIN.sh

About

SSH Login template script for easy SSH Authentication

License:GNU General Public License v3.0


Languages

Language:Shell 100.0%