前言
群晖自带的文件共享曾经很好用了,笼罩了大部份应用场景,然而你敌人手机上可能没有装置smb客户端利用。于是就想找一个网页版的文件共享服务器,用来共享些常用工具app,顺便上传点临时文件,内网应用,不设置账号密码。
下载软件
公布地址 https://github.com/mjpclab/go...
# 查看cpu架构sudo -iroot@DS_cat:~# dpkg --print-architecturearmelroot@DS_cat:~# cat /proc/cpuinfo | grep modelmodel name : ARMv8 Processor rev 4 (v8l)model name : ARMv8 Processor rev 4 (v8l)
下载地址 https://github.com/mjpclab/go...
解压后失去一个 ghfs
文件
装置配置
# 新建软件目录 把ghfs文件传到这个目录mkdir -p /volume1/opt/ghfs# 新建服务器的根目录 和 一个用于上传的目录mkdir -p '/volume1/share/web_file_server/长期文件夹(可上传)'# 创立配置文件cd /volume1/opt/ghfsvi ghfs.ini
配置文件内容如下:
--listen-plain 192.168.1.8:8888--root /volume1/share/web_file_server/--upload /长期文件夹(可上传)--delete /长期文件夹(可上传)--hide-dir @eaDir--access-log /volume1/opt/ghfs/access.log--error-log /volume1/opt/ghfs/error.log
配置文件部份阐明
- @eaDir是群晖生成的文件夹 设置为不显示
- 指定IP和端口号 80端口被群晖占用了
- 设置长期文件夹操作权限 可上传 可删除
运行测试
root@DS_cat:/volume1/opt/ghfs# ./ghfs --config ghfs.iniHost 0 may be accessed by URLs: http://192.168.1.8:8888
web_file_server目录轻易放些apk jpg等文件
手机浏览器拜访 192.168.1.8:8888
- 首页是个文件列表
- apk能够下载安装
- 图片能间接网页浏览 也能下载下来
- 长期文件夹(可上传) 进入这个文件夹能够上传文件
增加到零碎服务 开机自启
不同零碎的配置可能不太一样 我目前的版本是 DS120j DSM 6.2.4-25556 Update 6
新建服务配置文件 /volume1/opt/ghfs/upstart.conf
内容如下:
#only start this service after the nginx process has startedstart on started nginx#stop the service gracefully if the runlevel changes to 'reboot'stop on runlevel [06]#run the scripts as the 'http' user. Running as root (the default) is a bad idea.#setuid http#exec the process. Use fully formed path names so that there is no reliance on $PATHexec /volume1/opt/ghfs/ghfs --config /volume1/opt/ghfs/ghfs.ini
# 增加自启服务配置文件cp upstart.conf /etc/init/ghfs.conf# 命令行启动服务测试root@DS_cat:/volume1/opt/ghfs# start ghfsghfs start/running, process 30141# 进行服务root@DS_cat:/volume1/opt/ghfs# stop ghfsghfs stop/waiting
两头的一些折腾 能够疏忽
默认用root账户跑服务 不太安心 改成http用户吧
# 批改启动用户为 http# 去掉 /etc/init/ghfs.conf 文件中 '#setuid http' 后面的 '#'# 为http增加权限chown http:http -R /volume1/opt/ghfschown http:users -R /volume1/share/web_file_serverchmod 750 -R /volume1/share/web_file_server
此时网页拜访可能会呈现 403禁止拜访资源 目录权限改成777也没用 须要到群晖做些权限设置
控制面板-用户群组-http-编辑-权限
在share一栏增加 只读权限 最初点确定保留 就能够失常拜访了
刚开始找的几个文件服务器也都能用 然而想暗藏群晖全局搜寻服务生成的@eaDir文件夹的话 设置不了或比拟麻烦
- https://github.com/svenstaro/...
- https://github.com/codeskyblu...
本想建个软链接来用 发现不行
root@DS_cat:/volume1/opt/ghfs# ln -s upstart.conf /etc/init/ghfs.confroot@DS_cat:/volume1/opt/ghfs# start ghfsstart: Unknown job: ghfs
一些援用参考
群晖 @eaDir 目录阐明
- https://zhuanlan.zhihu.com/p/...
- https://tech.webit.nu/synolog...
开机启动参考
- https://gist.github.com/SanCo...
- https://openpeerpower.io/docs...
- https://segmentfault.com/a/11...
- https://forum.duplicati.com/t...