https://github.com/dhi13man/change_ssh_profiles
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.
https://github.com/dhi13man/change_ssh_profiles
automation go golang python python3 script ssh
Last synced: 7 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/dhi13man/change_ssh_profiles
- Owner: Dhi13man
- License: mit
- Created: 2023-06-03T13:22:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-22T05:06:56.000Z (about 1 year ago)
- Last Synced: 2025-01-22T06:22:15.399Z (about 1 year ago)
- Topics: automation, go, golang, python, python3, script, ssh
- Language: Python
- Homepage: https://medium.com/@dhi13man/streamline-your-ssh-configurations-a-journey-into-developing-an-ssh-profile-switcher-b32a1f8622c4
- Size: 1.19 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE.MD
Awesome Lists containing this project
README
# SSH Profile Switcher
[](https://github.com/Dhi13man/change_ssh_profiles/blob/main/LICENSE)
[](https://github.com/Dhi13man/change_ssh_profiles/graphs/contributors)
[](https://github.com/Dhi13man/change_ssh_profiles/network/members)
[](https://github.com/Dhi13man/change_ssh_profiles/stargazers)
[](https://github.com/Dhi13man/change_ssh_profiles/commits/main)
[](https://github.com/Dhi13man/change_ssh_profiles/actions)
[](https://github.com/Dhi13man/change_ssh_profiles/actions)
[](https://golang.org/)
[](https://www.python.org/)
[](https://www.buymeacoffee.com/dhi13man)
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:
```bash
go run main.go
```
Replace `` 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:
```bash
go run main.go ...
```
### Golang Usage Example
To activate the "work" SSH profile and disable all other profiles using the Go script, use the following command:
```bash
go run main.go work
```
## Python Implementation
### Python Usage
To activate a specific SSH profile using the Python script, use the following command:
```bash
python __main__.py -p
```
Replace `` 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 `PROFILE_MAP` dictionary in the script.
You can specify multiple profile names to activate multiple profiles at once:
```bash
python __main__.py -p ...
```
### Python Usage Example
To activate the "work" SSH profile and disable all other profiles using the Python script, use the following command:
```bash
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.