Giter Club home page Giter Club logo

dhi13man / change_ssh_profiles Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.22 MB

Golang and Python implementation of a script allowing you to activate specific SSH profiles while disabling all other profiles, providing a convenient way to manage and switch SSH configurations based on need.

Home Page: https://medium.com/@dhi13man/streamline-your-ssh-configurations-a-journey-into-developing-an-ssh-profile-switcher-b32a1f8622c4

License: MIT License

Python 50.30% Go 49.70%
automation go golang python python3 script ssh

change_ssh_profiles's Introduction

SSH Profile Switcher

License Contributors GitHub forks GitHub Repo stars Last Commit Build, Format, Test | Golang Build, Format, Test | Python

Language | Golang Language | Python

"Buy Me A Coffee"

This repository contains two implementations of an SSH profile Switcher script: one in Python and another in Go. These scripts allow you to activate a specific SSH profile while disabling all other profiles, providing a convenient way to manage and switch between different SSH configurations based on your needs.

Prerequisites

Before using either of the scripts, ensure that you have the following:

  • Python 3 installed on your system (for the Python script)
  • Go installed on your system (for the Go script)
  • SSH profiles set up with their respective private key files

Golang Implementation

Golang Usage

To activate a specific SSH profile using the Go script, use the following command:

go run main.go <profile_name>

Replace <profile_name> with the name of the profile you want to activate. By default, profile names include:

  • work: Assumed to be a profile with the private key located in "{HOME_DIR}/.ssh/work_rsa"
  • personal: Assumed to be a profile with the private key located in "{HOME_DIR}/.ssh/id_rsa"

You can add more profiles or change the paths to existing profiles by modifying the profileMap dictionary in the script.

You can specify multiple profile names to activate multiple profiles at once:

go run main.go <profile1> <profile2> ...

Golang Usage Example

To activate the "work" SSH profile and disable all other profiles using the Go script, use the following command:

go run main.go work

Python Implementation

Python Usage

To activate a specific SSH profile using the Python script, use the following command:

python __main__.py -p <profile_name>

Replace <profile_name> with the name of the profile you want to activate.

You can add more profiles or change the paths to existing profiles by modifying the PROFILE_MAP dictionary in the script.

You can specify multiple profile names to activate multiple profiles at once:

python __main__.py -p <profile1> <profile2> ...

Python Usage Example

To activate the "work" SSH profile and disable all other profiles using the Python script, use the following command:

python __main__.py -p work

Important Notes

  • Make sure you have the necessary permissions to access the SSH key files.

  • The scripts assume that the SSH profile key files are located in the .ssh directory in the user's home directory. If your key files are located elsewhere, you will need to modify the scripts accordingly.

  • For the Python script, ensure that Python 3 is installed on your system and that the necessary dependencies are met.

  • For the Golang script, ensure that Go is installed on your system and that the Go environment is properly set up.

Feel free to modify and extend these scripts to suit your specific needs.

change_ssh_profiles's People

Contributors

dhi13man avatar dhimanseal-groww avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.