{"id":17382920,"url":"https://github.com/donnitriosa/ssh-script","last_synced_at":"2025-03-27T20:48:48.755Z","repository":{"id":255147862,"uuid":"848681217","full_name":"donnitriosa/Ssh-Script","owner":"donnitriosa","description":"This is a Bash script to automate SSH connections based on predefined commands stored in text files.","archived":false,"fork":false,"pushed_at":"2024-08-28T09:58:42.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T23:26:55.499Z","etag":null,"topics":["automation","script","secure","secure-shell","shell","ssh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donnitriosa.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-28T07:55:26.000Z","updated_at":"2024-09-10T04:32:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"7903c59a-b84f-4318-a0f8-19df1c95c9c3","html_url":"https://github.com/donnitriosa/Ssh-Script","commit_stats":null,"previous_names":["donnitriosa/ssh-script"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donnitriosa%2FSsh-Script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donnitriosa%2FSsh-Script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donnitriosa%2FSsh-Script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donnitriosa%2FSsh-Script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donnitriosa","download_url":"https://codeload.github.com/donnitriosa/Ssh-Script/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245924493,"owners_count":20694728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","script","secure","secure-shell","shell","ssh"],"created_at":"2024-10-16T07:39:50.397Z","updated_at":"2025-03-27T20:48:48.726Z","avatar_url":"https://github.com/donnitriosa.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSH Script\n\nThis is a Bash script to automate SSH connections based on predefined commands stored in text files.\n\n## Overview\n\nThe script allows you to select and execute SSH commands from a predefined list stored in text files. Each text file contains a list of SSH commands, and the script will prompt you to choose which command to execute.\n\n## Prerequisites\n\n- Bash\n- SSH\n\n## Setup\n\n1. **Modify the Directory Path**: Open the script file `myssh.sh` and change the `directory` variable to the path where your command files are stored. For example:\n\n\t```shell\n\t# Directory containing the files\n\tdirectory=\"/path/to/your/ssh-script-directory\"\n\t```\n\tReplace `/path/to/your/ssh-script-directory` with the actual path to your directory.\n\n## Usage\n1.  **Place your command files**: Create text files in the specified directory. Each file should contain SSH commands, one per line.\n2.  **Run the script**: Execute the script with the name of the command file (without the  `.txt`  extension) as a parameter.\n\t```\n\t./myssh.sh \u003ccommand_file_name\u003e\n\t```\n### Example\nIf you have a file named  `example.txt`  in your specified \tdirectory, run the script as follows:\n```\n./myssh.sh  example\n```\n\t\n### Script Details\n-   The script validates that a parameter is provided.\n-   It searches for a file in the specified directory that matches the provided parameter.\n-   If the file is found, it displays the content up to the first empty line.\n-   It prompts the user to enter a choice.\n-   Based on the user's choice, it executes the corresponding SSH command from the file.\n\n### Error Handling\n\n-   If no parameter is provided, the script exits with a message indicating that a parameter is required.\n-   If the specified file is not found, the script exits with a message indicating that the file was not found.\n-   If the user enters an invalid choice, the script exits with a message indicating invalid input.\n\n## Example Command File\nHere is an example of what a command file (`example.txt`) might look like:\n```txt\n# Server List\nserver1 user@192.168.1.1\nserver2 user@192.168.1.2\n\n# Commands\nuser@192.168.1.1\nuser@192.168.1.2\n```\nIn this example, the script will display the server list and prompt the user to choose a server. Based on the user's choice, it will execute the corresponding SSH command.\n\n## Author\nCreated by [Donni Triosa](https://www.linkedin.com/in/donnitriosa/) (donni.triosa94@gmail.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonnitriosa%2Fssh-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonnitriosa%2Fssh-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonnitriosa%2Fssh-script/lists"}