[GH-ISSUE #4743] ssh tunnel config error while systemctl #3746

Closed
opened 2026-05-05 14:24:00 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @itsKV on GitHub (Apr 6, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4743

Bug Description

Using sshTunnelGateway.bindPort = 2200 in toml file fails the frps systemctl service to start. But executing the frps binary directly with the same toml file runs successfully.

Is there any wrong from me ?

Following is the frps.service file content.

[Unit]
Description=FRP Server Service
After=network.target
[Service]
ExecStart=/usr/local/bin/frp/frps -c /usr/local/bin/frp/frps.toml
Type=simple
DynamicUser=yes
Restart=on-failure
RestartSec=5s
LimitNOFILE=1048576
[Install]
WantedBy=multi-user.target

frpc Version

0.61.2

frps Version

0.61.2

System Architecture

linux/arm64

Configurations

#frps.toml
bindAddr = "0.0.0.0"
bindPort = 17777
kcpBindPort = 17777

webServer.addr = "127.0.0.1"
webServer.port = 7500
webServer.user = "adm"
webServer.password = "aidmn"
webServer.pprofEnable = true

auth.method = "token"
auth.token = "12345678"

subDomainHost = "sub.domain.tld"

allowPorts = [ { start = 5000, end = 6000 } ]

sshTunnelGateway.bindPort = 2200

Logs

No response

Steps to reproduce

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @itsKV on GitHub (Apr 6, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4743 ### Bug Description Using `sshTunnelGateway.bindPort = 2200` in toml file fails the frps systemctl service to start. But executing the frps binary directly with the same toml file runs successfully. Is there any wrong from me ? Following is the frps.service file content. ``` [Unit] Description=FRP Server Service After=network.target [Service] ExecStart=/usr/local/bin/frp/frps -c /usr/local/bin/frp/frps.toml Type=simple DynamicUser=yes Restart=on-failure RestartSec=5s LimitNOFILE=1048576 [Install] WantedBy=multi-user.target ``` ### frpc Version 0.61.2 ### frps Version 0.61.2 ### System Architecture linux/arm64 ### Configurations ``` #frps.toml bindAddr = "0.0.0.0" bindPort = 17777 kcpBindPort = 17777 webServer.addr = "127.0.0.1" webServer.port = 7500 webServer.user = "adm" webServer.password = "aidmn" webServer.pprofEnable = true auth.method = "token" auth.token = "12345678" subDomainHost = "sub.domain.tld" allowPorts = [ { start = 5000, end = 6000 } ] sshTunnelGateway.bindPort = 2200 ``` ### Logs _No response_ ### Steps to reproduce _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [x] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [x] Others
Author
Owner

@fatedier commented on GitHub (Apr 7, 2025):

Do you think I can draw any conclusions from the information you provided? There isn't even any infromation about the failure.

<!-- gh-comment-id:2781948858 --> @fatedier commented on GitHub (Apr 7, 2025): Do you think I can draw any conclusions from the information you provided? There isn't even any infromation about the failure.
Author
Owner

@itsKV commented on GitHub (Apr 9, 2025):

Hello fatedier,

I am sorry for not being clear at first.
The issue is, when I start frps by running binary directly from command, starts the frps successfully and works fine. Following is the screenshot of running the binary.

Image

But when I execute frps with same config from systemctl service manager using command sudo systemctl start frps , the service starts but fails immediately. I can confirm the failure with status command. Following is the screenshot.

Image

I don't understand why binary executes but the same with the service fails.

When I comment out the sshTunnelGateway.bindPort = 2200 command from toml file, the systemctl service does not give any issue and runs smoothly.

<!-- gh-comment-id:2788951331 --> @itsKV commented on GitHub (Apr 9, 2025): Hello fatedier, I am sorry for not being clear at first. The issue is, when I start frps by running binary directly from command, starts the frps successfully and works fine. Following is the screenshot of running the binary. ![Image](https://github.com/user-attachments/assets/b968a767-f7f0-4529-8b78-c4641867f3b0) But when I execute frps with same config from systemctl service manager using command `sudo systemctl start frps` , the service starts but fails immediately. I can confirm the failure with `status` command. Following is the screenshot. ![Image](https://github.com/user-attachments/assets/cbc2ba50-8b99-4906-a2b2-d078268cdcf9) I don't understand why binary executes but the same with the service fails. When I comment out the `sshTunnelGateway.bindPort = 2200` command from toml file, the systemctl service does not give any issue and runs smoothly.
Author
Owner

@fatedier commented on GitHub (Apr 9, 2025):

Check the system logs for more detailed error messages. You can use journalctl -u frps to view the logs for the frps service.

<!-- gh-comment-id:2788984874 --> @fatedier commented on GitHub (Apr 9, 2025): Check the system logs for more detailed error messages. You can use journalctl -u frps to view the logs for the frps service.
Author
Owner

@itsKV commented on GitHub (Apr 12, 2025):

Troubleshooting with journalctl -u frps helped a lot. I found that with default configuration, frps was writing at ./.autogen_ssh_key location which is restricted with the given systemctl config.
I tweaked the autoGenPrivateKeyPath location and removed DynamicUser=yes switch from systemctl config file.

This cleared the issue and frps service started successfully.

<!-- gh-comment-id:2798727752 --> @itsKV commented on GitHub (Apr 12, 2025): Troubleshooting with `journalctl -u frps` helped a lot. I found that with default configuration, frps was writing at `./.autogen_ssh_key` location which is restricted with the given systemctl config. I tweaked the `autoGenPrivateKeyPath` location and removed `DynamicUser=yes` switch from systemctl config file. This cleared the issue and frps service started successfully.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#3746
No description provided.