{"id":24708083,"url":"https://github.com/pungrumpy/go-ssh-demo","last_synced_at":"2025-03-22T06:13:28.707Z","repository":{"id":154011489,"uuid":"631342218","full_name":"PunGrumpy/go-ssh-demo","owner":"PunGrumpy","description":"This is a simple script to generate SSH keys for a user on a remote server.","archived":false,"fork":false,"pushed_at":"2023-05-02T08:18:17.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T06:32:16.670Z","etag":null,"topics":["go","golang","ssh","ssh-key","ssh-key-generator"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/PunGrumpy/go-ssh-key/ssh","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PunGrumpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-04-22T18:06:14.000Z","updated_at":"2023-04-23T09:29:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4177727-04c5-44b7-89c5-50570caaa094","html_url":"https://github.com/PunGrumpy/go-ssh-demo","commit_stats":null,"previous_names":["pungrumpy/go-ssh-key"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PunGrumpy%2Fgo-ssh-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PunGrumpy%2Fgo-ssh-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PunGrumpy%2Fgo-ssh-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PunGrumpy%2Fgo-ssh-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PunGrumpy","download_url":"https://codeload.github.com/PunGrumpy/go-ssh-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244913330,"owners_count":20530817,"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":["go","golang","ssh","ssh-key","ssh-key-generator"],"created_at":"2025-01-27T06:27:43.765Z","updated_at":"2025-03-22T06:13:28.702Z","avatar_url":"https://github.com/PunGrumpy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go SSH Keygeneration\n\nThis is a simple script to generate SSH keys for a user on a remote server.\n\n## Usage\n\n```bash\ntouch main.go\ngo get github.com/PunGrumpy/go-ssh-demo/ssh\ncode main.go\n```\n\n### Generate Key\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"os\"\n\n    \"github.com/PunGrumpy/go-ssh-demo/ssh\"\n)\n\nfunc main() {\n    var (\n        publicKey, privateKey []byte\n        err                   error\n    )\n    if publicKey, privateKey, err = ssh.GenerateKey(); err != nil {\n        log.Fatal(err)\n    }\n    if err = os.WriteFile(\"my_private_key\", privateKey, 0600); err != nil {\n        log.Fatal(err)\n    }\n    if err = os.WriteFile(\"server_public_key\", publicKey, 0644); err != nil {\n        log.Fatal(err)\n    }\n    fmt.Println(\"Done ✅\")\n}\n```\n\n### Server Run\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\n    \"github.com/PunGrumpy/go-ssh-demo/ssh\"\n)\n\nfunc main() {\n\tvar (\n\t\terr error\n\t)\n\tserverKeyBytes, err := ioutil.ReadFile(\"my_private_key.pem\")\n\tif err != nil {\n\t\tfmt.Printf(\"unable to read server key: %v\", err)\n\t}\n\n\tauthorizedKeysBytes, err := ioutil.ReadFile(\"server_public_key.pub\")\n\tif err != nil {\n\t\tfmt.Printf(\"unable to read authorized keys: %v\", err)\n\t}\n\n\tif err = ssh.StartServer(serverKeyBytes, authorizedKeysBytes); err != nil {\n\t\tfmt.Printf(\"unable to start SSH server: %v\", err)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpungrumpy%2Fgo-ssh-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpungrumpy%2Fgo-ssh-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpungrumpy%2Fgo-ssh-demo/lists"}