HFS is a file server offering a virtual file system (vfs). You can easily share a single file instead of the whole folder, or you can rename it, but without touching the real file, just virtually.
Listing files, searching files, zipping folders, it's all very fast, streamed while data is produced, so you don't have to wait.
类似于 轻量网盘,文件分享工具filebrowser的部署,不同点在于
- HFS 只提供文件共享功能(无法上传只能下载)
- 共享文件时无需共享整个目录
- 所有被共享的文件只通过 HFS 提供的虚拟文件系统访问,与实际文件隔离,更安全
环境
- Debian 11
参考
步骤
获取 HFS
在 https://github.com/rejetto/hfs/releases/latest 获取最新版本链接
# apt install unzip wget https://github.com/rejetto/hfs/releases/download/v0.20.0/hfs-linux.zip unzip -d hfs hfs-linux.zip
新建管理员账户
HFS 会默认从同目录下的 accounts.yaml 读取用户信息
在 HFS 同目录下新建 accounts.yaml,写入以下内容
accounts: admin: password: veryStrongPassword admin: true ignore_limits: true belongs: administrator administrator:
HFS 运行后会读取 accounts.yaml 并生成对应的 config.yaml,其中包含了 accounts.yaml 中定义的用户
配置系统服务
在 /etc/systemd/system 新建 hfs.service 文件,写入如下内容
[Unit] Description=HFS server After=network.target [Service] TimeoutStopSec=2 WorkingDirectory=/path/to/hfs ExecStart=/path/to/hfs/hfs [Install] WantedBy=multi-user.target
运行 HFS
systemctl start hfs # 自启 systemctl enable hfs
浏览器访问 IP 地址即可使用,访问管理员页面需要进入 IP/~/admin