mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #3736] 如何禁用通过frp进行sftp传输文件? #2972
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#2972
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Corner430 on GitHub (Oct 31, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3736
Describe the feature request
我有一台电脑,是Ubuntu系统,这台电脑是在局域网,当我在局域网时候是通过局域网ip进行ssh连接和sftp传文件。为了让我在外面也能连接到这台电脑,我买了一个腾讯云服务器,通过腾讯云服务器的ip在这台电脑上做了一个frp内网穿透,这样一来我就可以在外面通过frp进行ssh连接了,但问题是我想禁用通过frp进行sftp传文件,因为这太昂贵了,但是却要保留在局域网内可以通过sftp传文件。应该怎么操作呢?
一言以蔽之,怎么在单单禁用通过frp进行sftp传输文件呢?
Describe alternatives you've considered
No response
Affected area
@Corner430 commented on GitHub (Oct 31, 2023):
I have a computer running Ubuntu in a local network. When I'm within the local network, I use the local IP to SSH and SFTP into this computer. To enable remote access from outside the network, I've purchased a Tencent Cloud server and set up FRP (Frp2) for intranet penetration using the Tencent Cloud server's IP. This allows me to SSH into the computer remotely through FRP. However, I want to disable SFTP file transfer through FRP as it's quite costly, but I still want to retain the ability to use SFTP within the local network. How can I achieve this?
In short, how can I solely disable SFTP file transfer through FRP?
@superzjg commented on GitHub (Oct 31, 2023):
frp是通过某端口转发数据而已。
你应该把“系统ssh和sftp的端口设为不同“,或者说“ssh和sftp服务分离”。
你可以搜索引号内的关键词,有些文章参考。
ps. 觉得你在外网访问ssh就好了,不通过它传文件就可以了,自己主观控制,为何一定要关闭。
@Corner430 commented on GitHub (Oct 31, 2023):
感谢您的回答。是这样的,我希望可以通过是否通过frp连入而决定是否可以使用sftp服务。如果是通过frp连入,那么就拒绝使用sftp,否则就允许。
遗憾的是防火墙无法对于frp连入的服务进行正确的ip匹配。
之所以要进行这样的运维是由于用户太多了。
我现在正在尝试通过 环境变量 SSH_CONNECTION 和 日志文件 /var/log/auth.log 进行异常的 ip规则匹配。
总之,我希望可以让用户通过frp连入的时候,禁用sftp,也就是不能通过frp进行sftp传输文件。
ps. 大家传的文件太大了,动辄几十GB,占用带宽,影响了其他用户。
@superzjg commented on GitHub (Oct 31, 2023):
获取ip可以参考frp的这一功能:
https://gofrp.org/zh-cn/docs/features/common/realip/
不过我还是觉得把ssh和sftp的端口分开比较好,不使用同一端口22,frp也就不会转发了。
@Corner430 commented on GitHub (Oct 31, 2023):
明白了,非常感谢,我现在去尝试一下