Skip to content

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.

License

Notifications You must be signed in to change notification settings

Dhi13man/change_ssh_profiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published