Automate your SSH logins with this .bat script for your private network.

Rahul Negi
2 min readFeb 10, 2022

If you’re work requires a lot of interactions with private servers, this might come handy.

Automate your SSH logins

A simple bash script to automate your login process, really handful for backend-devs or Dev-Ops engineers.

Let’s get into it

Requirement :

  • putty.exe

“PuTTY ” is open source software that is available with source code and is developed and supported by a group of volunteers. You can download PuTTY here.

I’m presenting scripts in 3 ways, use what suits your need best. All these scripts are available here.

Three ways

  1. Single server login

This is the best method if you have mostly or only used one server, this is just one click away method.

single-ssh.bat

2. Enter the last three digits to your address.

This method is helpful if you have multiple machine in same network, you can just enter last three digits of the address.

suffix-based-login.bat

3. Just enter a number .

This is the best method if you have multiple logins, you can just create a hash-map type relation.

Example:

cmd.exe
multiple-logins.bat

That’s it for now, though I want to mention one important thing which is,

If you’re desktop has multiple users, it is advisable to not store your password in the script instead use this to take input manually.

set /p password="Enter password: "
enter-password.bat

I know it kills the half the fun of automation but still security is must.

Open to feedback and suggestions.

Thanks :’) for reading.

--

--

Rahul Negi

Passionate Learner | Python | Django | Selenium | ML