{"id":15494945,"url":"https://github.com/fracpete/rpi-remote-access","last_synced_at":"2025-04-22T20:27:01.752Z","repository":{"id":146381515,"uuid":"425986703","full_name":"fracpete/rpi-remote-access","owner":"fracpete","description":"Remote access to a Raspberry Pi via reverse proxy frp.","archived":false,"fork":false,"pushed_at":"2021-11-22T01:01:34.000Z","size":12,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-19T12:15:56.935Z","etag":null,"topics":["frp","raspberry-pi","remote-access","reverse-proxy"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fracpete.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":"2021-11-08T20:39:23.000Z","updated_at":"2023-09-14T19:17:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"7575e97c-56df-4bf1-841d-44ed27b72be7","html_url":"https://github.com/fracpete/rpi-remote-access","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"240cf5638523264b0bd6fd6ae503e17a99ae2353"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Frpi-remote-access","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Frpi-remote-access/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Frpi-remote-access/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Frpi-remote-access/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fracpete","download_url":"https://codeload.github.com/fracpete/rpi-remote-access/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250317765,"owners_count":21410810,"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":["frp","raspberry-pi","remote-access","reverse-proxy"],"created_at":"2024-10-02T08:15:38.748Z","updated_at":"2025-04-22T20:27:01.746Z","avatar_url":"https://github.com/fracpete.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpi-remote-access\nIn order to get ssh access to a Raspberry Pi (e.g., through a 4G modem or if it is behind a firewall), the [frp](https://github.com/fatedier/frp/) reverse proxy can be used.\n\nFor this purpose, a server with a public IP or DNS name will act as server (e.g., an AWS server in the free tier) that the Raspberry Pi will connect to.\n\n## Server (eg cloud VM)\n\nInbound ports that need to be open:\n\n* 22 - for general ssh access\n* 7000 - general inbound connections from clients\n* 6000 - for accepting ssh connections and forwarding them to the client (unique to each client)\n\nServer requires DNS name or fixed IP address. DynDNS, like [noip.com](https://noip.com/), \nworks as well. See the [DynDNS](dyndns.md) article for instructions.\n\nFor this example, we are assuming `mydevice.ddns.net` as the server DNS name.\n\nInstall frp:\n* Download appropriate [release binary](https://github.com/fatedier/frp/releases/tag/v0.37.1)\n  ```bash\n  sudo bash\n  cd /opt\n  wget https://github.com/fatedier/frp/releases/download/v0.37.1/frp_0.37.1_linux_amd64.tar.gz\n  tar -xzf frp_0.37.1_linux_amd64.tar.gz\n  ln -s frp_0.37.1_linux_amd64 frp\n  ```\n\n* Create `/etc/frps.ini` with the following content:\n  ```ini\n  [common]\n  bind_port = 7000\n  ```\n  \n* Create systemd service `/etc/systemd/system/frps.service` with the following content:\n\n  ```ini\n  [Unit]\n  Description=frp reverse proxy server\n  After=network.target\n  \n  [Service]\n  User=ubuntu\n  Group=ubuntu\n  WorkingDirectory=/opt/frp\n  ExecStart=/opt/frp/frps -c /etc/frps.ini\n  \n  [Install]\n  WantedBy=multi-user.target\n  ```\n  \n* Install systemd service\n  ```bash\n  sudo systemctl enable /etc/systemd/system/frps.service\n  ```\n  \n* Start service\n  ```bash\n  sudo systemctl start frps.service\n  ```\n\n## Client (Raspberry Pi)\n\nInbound ports that need to be open:\n\n* 22 - for ssh access\n\nInstall frp:\n* Download appropriate [release binary](https://github.com/fatedier/frp/releases/tag/v0.37.1)\n\n  * 32-bit\n    ```bash\n    sudo bash\n    cd /opt\n    wget https://github.com/fatedier/frp/releases/download/v0.37.1/frp_0.37.1_linux_arm.tar.gz\n    tar -xzf frp_0.37.1_linux_arm.tar.gz\n    ln -s frp_0.37.1_linux_arm frp\n    ```\n\n  * 64-bit\n    ```bash\n    sudo bash\n    cd /opt\n    wget https://github.com/fatedier/frp/releases/download/v0.37.1/frp_0.37.1_linux_arm64.tar.gz\n    tar -xzf frp_0.37.1_linux_arm64.tar.gz\n    ln -s frp_0.37.1_linux_arm64 frp\n    ```\n\n* Create `/etc/frpc.ini` with the following content:\n  ```ini\n  [common]\n  server_addr = mydevice.ddns.net\n  server_port = 7000\n  \n  [ssh]\n  type = tcp\n  local_ip = 127.0.0.1\n  local_port = 22\n  remote_port = 6000\n  ```\n  \n* Create systemd service `/etc/systemd/system/frpc.service` with the following content:\n\n  ```ini\n  [Unit]\n  Description=frp reverse proxy client\n  After=network.target\n  \n  [Service]\n  User=pi\n  Group=pi\n  Restart=on-failure\n  RestartSec=15s\n  WorkingDirectory=/opt/frp\n  ExecStart=/opt/frp/frpc -c /etc/frpc.ini\n  \n  [Install]\n  WantedBy=multi-user.target\n  ```\n  \n* Install systemd service\n  ```bash\n  sudo systemctl enable /etc/systemd/system/frpc.service\n  ```\n  \n* Start service\n  ```bash\n  sudo systemctl start frpc.service\n  ```\n\n## Raspberry Pi access\nChanging remote access to the Raspberry Pi to using ssh-keys only (as user `pi`):\n* On admin laptop create a ssh key in `$HOME/.ssh`:\n  ```bash\n  ssh-keygen -f mydevice\n  ```\n* Output the content of the public key (`mydevice.pub`) and paste it on the Raspberry Pi into `/home/pi/.ssh/authorized_keys`\n* On admin laptop, create the following entry in `$HOME/.ssh/config`:\n  ```\n  Host mydevice\n    User pi\n    Hostname mydevice.ddns.net\n    Port 6000\n    IdentityFile ~/.ssh/mydevice\n  ```\n* On Raspberry Pi, edit the `/etc/ssh/sshd_config` file and disable password authentication:\n  ```\n  PasswordAuthentication no\n  ```\n* Restart the `ssh` service on the Raspberry Pi\n  ```bash\n  sudo systemctl restart ssh\n  ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffracpete%2Frpi-remote-access","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffracpete%2Frpi-remote-access","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffracpete%2Frpi-remote-access/lists"}