Seafile

Seafile

这是 Seafile 存储服务的后端:

  • 它同时支持免费社区版和专业版。
  • 支持 Seafile 6.x、7.x、8.x 和 9.x 版本。
  • 也支持加密库。
  • 支持启用了双因素认证(2FA)的用户。
  • 支持使用库 API 令牌。

配置

你可以通过两种不同的模式来设置远程存储:

  • 将远程存储指向服务器的根目录,即在配置过程中不指定具体的库: 路径指定为 remote:library。你也可以指定子目录,例如 remote:library/path/to/dir
  • 在配置过程中将远程存储指向特定的库: 路径指定为 remote:path/to/dir在使用加密库时,建议使用此模式。(此模式可能比根目录模式稍快一些

根目录模式配置

以下是一个为没有启用双因素认证的用户配置 Seafile 远程存储的示例。首先运行:

rclone config

这将引导你完成一个交互式的设置过程。进行身份验证时,你需要提供服务器的 URL、你的电子邮件地址(或用户名)以及密码。

No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> seafile
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
[snip]
XX / Seafile
   \ "seafile"
[snip]
Storage> seafile
** See help for seafile backend at: https://rclone.org/seafile/ **

URL of seafile host to connect to
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Connect to cloud.seafile.com
   \ "https://cloud.seafile.com/"
url> http://my.seafile.server/
User name (usually email address)
Enter a string value. Press Enter for the default ("").
user> [email protected]
Password
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank (default)
y/g> y
Enter the password:
password:
Confirm the password:
password:
Two-factor authentication ('true' if the account has 2FA enabled)
Enter a boolean value (true or false). Press Enter for the default ("false").
2fa> false
Name of the library. Leave blank to access all non-encrypted libraries.
Enter a string value. Press Enter for the default ("").
library>
Library password (for encrypted libraries only). Leave blank if you pass it through the command line.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank (default)
y/g/n> n
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
Two-factor authentication is not enabled on this account.
--------------------
[seafile]
type = seafile
url = http://my.seafile.server/
user = [email protected]
pass = *** ENCRYPTED ***
2fa = false
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

这个远程存储名为 seafile。它指向你的 Seafile 服务器的根目录,现在可以像这样使用它:

查看所有库

rclone lsd seafile:

创建一个新库

rclone mkdir seafile:library

列出库的内容

rclone ls seafile:library

/home/local/directory 同步到远程库,并删除库中多余的文件。

rclone sync --interactive /home/local/directory seafile:library

库模式配置

以下是一个为启用了双因素认证的用户进行库模式配置的示例。在配置结束时会要求你输入 2FA 代码,并尝试对你进行身份验证:

No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> seafile
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
[snip]
XX / Seafile
   \ "seafile"
[snip]
Storage> seafile
** See help for seafile backend at: https://rclone.org/seafile/ **

URL of seafile host to connect to
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Connect to cloud.seafile.com
   \ "https://cloud.seafile.com/"
url> http://my.seafile.server/
User name (usually email address)
Enter a string value. Press Enter for the default ("").
user> [email protected]
Password
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank (default)
y/g> y
Enter the password:
password:
Confirm the password:
password:
Two-factor authentication ('true' if the account has 2FA enabled)
Enter a boolean value (true or false). Press Enter for the default ("false").
2fa> true
Name of the library. Leave blank to access all non-encrypted libraries.
Enter a string value. Press Enter for the default ("").
library> My Library
Library password (for encrypted libraries only). Leave blank if you pass it through the command line.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank (default)
y/g/n> n
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
Two-factor authentication: please enter your 2FA code
2fa code> 123456
Authenticating...
Success!
--------------------
[seafile]
type = seafile
url = http://my.seafile.server/
user = [email protected]
pass = 
2fa = true
library = My Library
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

你会注意到配置中的密码字段为空。这是因为我们只需要密码来对你进行一次身份验证。

在配置过程中,你指定了 My Library。远程存储的根目录指向 My Library 库的根目录:

查看库中的所有文件:

rclone lsd seafile:

在库中创建一个新目录

rclone mkdir seafile:directory

列出目录的内容

rclone ls seafile:directory

/home/local/directory 同步到远程库,并删除库中多余的文件。

rclone sync --interactive /home/local/directory seafile:

–fast-list

Seafile 7 及更高版本支持 --fast-list,它允许你以使用更多内存为代价,减少事务次数。有关更多详细信息,请参阅 rclone 文档。 请注意,Seafile 服务器 6.x 版本不支持此功能。

受限文件名字符

除了 默认受限字符集 之外,以下字符也会被替换:

字符 编码值 替换字符
/ 0x2F
" 0x22
\ 0x5C

无效的 UTF-8 字节也会被 替换,因为它们不能用于 JSON 字符串。

Seafile 和 rclone 链接

Rclone 仅支持为非加密库生成共享链接。 这些链接可以是文件或目录的链接:

rclone link seafile:seafile-tutorial.doc
http://my.seafile.server/f/fdcd8a2f93f84b8b90f4/

如果在一个目录上运行,则会得到

rclone link seafile:dir
http://my.seafile.server/d/9ea2455f6f55478bbb0d/

请注意,每个文件或目录的共享链接都是唯一的。如果你对已经共享过的文件或目录执行 link 命令,你将得到完全相同的链接。

兼容性

该功能是使用以下版本的 Seafile Docker 镜像 积极开发的:

  • 6.3.4 社区版
  • 7.0.5 社区版
  • 7.1.3 社区版
  • 9.0.10 社区版

不支持 6.0 以下的版本。 6.0 到 6.3 之间的版本未经测试,可能无法正常工作。

每个新版本的 rclone 都会自动针对 Seafile 社区服务器的 最新 Docker 镜像 进行测试。

标准选项

以下是 Seafile 特定的标准选项。

–seafile-url

要连接的 Seafile 主机的 URL。

属性:

  • 配置项:url
  • 环境变量:RCLONE_SEAFILE_URL
  • 类型:字符串
  • 是否必需:是
  • 示例:

–seafile-user

用户名(通常是电子邮件地址)。

属性:

  • 配置项:user
  • 环境变量:RCLONE_SEAFILE_USER
  • 类型:字符串
  • 是否必需:是

–seafile-pass

密码。

注意:输入此选项的值必须进行加密处理 - 请参阅 rclone obscure

属性:

  • 配置项:pass
  • 环境变量:RCLONE_SEAFILE_PASS
  • 类型:字符串
  • 是否必需:否

–seafile-2fa

双因素认证(如果账户启用了 2FA,则为 true)。

属性:

  • 配置项:2fa
  • 环境变量:RCLONE_SEAFILE_2FA
  • 类型:布尔值
  • 默认值:false

–seafile-library

库的名称。

留空以访问所有非加密库。

属性:

  • 配置项:library
  • 环境变量:RCLONE_SEAFILE_LIBRARY
  • 类型:字符串
  • 是否必需:否

–seafile-library-key

库密码(仅适用于加密库)。

如果通过命令行传递,则留空。

注意:输入此选项的值必须进行加密处理 - 请参阅 rclone obscure

属性:

  • 配置项:library_key
  • 环境变量:RCLONE_SEAFILE_LIBRARY_KEY
  • 类型:字符串
  • 是否必需:否

–seafile-auth-token

认证令牌。

属性:

  • 配置项:auth_token
  • 环境变量:RCLONE_SEAFILE_AUTH_TOKEN
  • 类型:字符串
  • 是否必需:否

高级选项

以下是 Seafile 特定的高级选项。

–seafile-create-library

如果库不存在,rclone 是否应该创建它。

属性:

  • 配置项:create_library
  • 环境变量:RCLONE_SEAFILE_CREATE_LIBRARY
  • 类型:布尔值
  • 默认值:false

–seafile-encoding

后端的编码方式。

有关更多信息,请参阅 概述中的编码部分

属性:

  • 配置项:encoding
  • 环境变量:RCLONE_SEAFILE_ENCODING
  • 类型:Encoding
  • 默认值:Slash,DoubleQuote,BackSlash,Ctl,InvalidUtf8

–seafile-description

远程存储的描述。

属性:

  • 配置项:description
  • 环境变量:RCLONE_SEAFILE_DESCRIPTION
  • 类型:字符串
  • 是否必需:否