SoFunction
Updated on 2025-03-10

The fastest way to log in to the ssh server

I don’t know if you have any experience in managing hundreds of Linux operating systems. Although you can log in without password through the ssh private key, I really seem to smash the keyboard when entering the server IP address dozens of times a day. So later I learned to be lazy to log in using shell scripts. The idea is just to pass the last ip address to the shell script, and you can log in as fast as possible. If there are IP addresses of multiple different subnets, just create the corresponding shell script.

How to use
[zongming@monitor ~]$ ssh5 113

Environment variables
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/home/zongming/sh

shell script
cat /home/zongming/sh/ssh5

Copy the codeThe code is as follows:

#!/bin/bash
#script_name:
#description:login ssh
#last_update:20130725 by zongming

if [ $# -eq 1 ];then
    ssh -v [email protected].${1}
else
    echo "Error:return value 1" && exit 1
fi