Mac 指定目录自动同步至私有云

以下为后期整理的简易版操作,如过要求比较高的话,建议参考官方的一些文档

如果你有 nas 那就不用这么折腾,我是趁着云厂商打活动去买的,一年才50,比 nas 实惠太多了

具我了解,此类自动同步目录至云盘做的好的只有坚果云,其他的还用过两种,都充过会员但体验不如坚果云就不推荐了

建立 kodbox 私有云

1
2
3
4
docker run -d -it --name kodbox -p 8000:80 -v /data/docker/kodbox:/var/www/html --restart=always tznb/kodbox:1.15

# 如果说想通过 web 页面去上传文件,则需对宿主机目录赋予权限
chmod -R 777 /data/docker/kodbox

mac 安装 sshfs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 由于 brew 现在不能直接安装 sshfs 了,会显示 Error: sshfs has been disabled because it requires closed-source macFUSE! 的报错。
# 去 github 中下载 pkg 包: https://github.com/osxfuse/sshfs/releases
wget https://github.com/osxfuse/sshfs/releases/download/osxfuse-sshfs-2.5.0/sshfs-2.5.0.pkg

# 文件挂载
sshfs username@server:path local_path
sshfs -C -o reconnect username@server:path local_path #添加重试
# 例如:
sshfs root@xxx.xxx.xxx.xxx:/data/docker/kodbox/mac_share /Users/macbook/kodbox_share

# 如果 ssh 端口不是默认的22端口需要添加 -p <端口号>

# 取消挂载
umount mount_path