{"id":27944869,"url":"https://github.com/devslem/ssh-localhost","last_synced_at":"2025-05-07T12:54:57.238Z","repository":{"id":237196072,"uuid":"793990461","full_name":"DevSlem/ssh-localhost","owner":"DevSlem","description":"Host a localhost of a remote server on your local machine.","archived":false,"fork":false,"pushed_at":"2024-05-01T07:40:27.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T12:54:51.271Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/DevSlem.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":"2024-04-30T08:48:18.000Z","updated_at":"2024-05-01T07:40:00.000Z","dependencies_parsed_at":"2024-04-30T11:14:48.228Z","dependency_job_id":"e6a5d5f3-463e-46e7-ad28-5c5cd908f2bb","html_url":"https://github.com/DevSlem/ssh-localhost","commit_stats":null,"previous_names":["devslem/ssh-localhost"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevSlem%2Fssh-localhost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevSlem%2Fssh-localhost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevSlem%2Fssh-localhost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevSlem%2Fssh-localhost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevSlem","download_url":"https://codeload.github.com/DevSlem/ssh-localhost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252882791,"owners_count":21819154,"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":[],"created_at":"2025-05-07T12:54:53.018Z","updated_at":"2025-05-07T12:54:57.221Z","avatar_url":"https://github.com/DevSlem.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSH-Localhost\n\nYou can host a localhost of a remote server on your local machine using SSH. This is useful when you host a localhost on a remote server and you want to access it on your local machine. For example, when you execute [Tensorboard](https://www.tensorflow.org/tensorboard) on the remote server where you're training a model, it is hosted on the remote server's localhost. If you use SSH command, you can access it on your local machine and stop the connection when you don't need to access it anymore. But, this process is too complicated using SSH command. So, I implemented a simple script to do this.\n\n## Installation\n\nIf you have [Rust](https://www.rust-lang.org/) installed on your machine, you can install the script using the following command:\n\n```bash\ncargo install --git https://github.com/DevSlem/ssh-localhost.git\n```\n\nIf you don't have Rust installed, you can download the binary at [Releases](https://github.com/DevSlem/ssh-localhost/releases) page and put it in your PATH.\n\n## Usage\n\nLet's assume that you're executing Tensorboard on the remote server where the user name is `testuser` and the IP address is `123.456.789.0`. The remote server's ssh port is open on `1234`. Tensorboard is hosted on the remote server's localhost port `6006` (Tensorboard default port). You want to access it on your local machine using port `4004`. In this case, you can use the following command:\n\n```bash\nssh-localhost -p 1234 testuser@123.456.789.0 6006 4004\n```\n\nThen, you can access it at the url `http://localhost:4004` on your local machine.\n\nBelow is the help message of the script:\n\n```\nHost a localhost of a remote server to your local machine\n\nUsage: ssh-localhost [OPTIONS] \u003cDESTINATION\u003e \u003cREMOTE_PORT\u003e [LOCAL_PORT]\n\nArguments:\n  \u003cDESTINATION\u003e  SSH destination format: `[ADDRESS]` or `[USER]@[ADDRESS]` or `[USER]@[ADDRESS]:[SSH_PORT]`. If you don't specify a ssh port, it will default to 22\n  \u003cREMOTE_PORT\u003e  Remote server's localhost port\n  [LOCAL_PORT]   Local machine's port to host the remote server's localhost. Defaults to same as remote port\n\nOptions:\n  -p \u003cP\u003e         SSH port of the remote server. Defaults to one specified in SSH config\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n\u003e Note that If you don't specify `[LOCAL_PORT]`, it will default to `[REMOTE_PORT]`. For example, `ssh-localhost -p 1234 testuser@123.456.789.0 6006` is equivalent to `ssh-localhost -p 1234 testuser@123.456.789.0 6006 6006`.\n\nYou can simply stop the connection by pressing `Ctrl+C`.\n\n### SSH Config\n\nIf you already configured your SSH config file (e.g., `~/.ssh/config`) like this:\n\n```\nHost testserver\n  HostName 123.456.789.0\n  User testuser\n  Port 1234\n```\n\nthen, you can easily access the remote server's localhost using the following simple command:\n\n```bash\nssh-localhost testserver 6006\n```\n\nIn this case, you don't need to specify user name, IP address, and SSH port.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevslem%2Fssh-localhost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevslem%2Fssh-localhost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevslem%2Fssh-localhost/lists"}