Citrix ShareFile
Citrix ShareFile 是一款面向企业的安全文件共享和传输服务。
配置
Citrix ShareFile 的初始设置需要从 Citrix ShareFile 获取一个令牌,你可以在浏览器中完成这一步骤。rclone config
命令会引导你完成整个过程。
以下是一个如何创建名为 remote
的远程存储的示例。首先运行:
rclone config
这将引导你完成一个交互式的设置过程:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> remote
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
XX / Citrix Sharefile
\ "sharefile"
Storage> sharefile
** See help for sharefile backend at: https://rclone.cn/sharefile/ **
ID of the root folder
Leave blank to access "Personal Folders". You can use one of the
standard values here or any folder ID (long hex number ID).
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Access the Personal Folders. (Default)
\ ""
2 / Access the Favorites folder.
\ "favorites"
3 / Access all the shared folders.
\ "allshared"
4 / Access all the individual connectors.
\ "connectors"
5 / Access the home, favorites, and shared folders as well as the connectors.
\ "top"
root_folder_id>
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=XXX
Log in and authorize rclone for access
Waiting for code...
Got code
Configuration complete.
Options:
- type: sharefile
- endpoint: https://XXX.sharefile.com
- token: {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"2019-09-30T19:41:45.878561877+01:00"}
Keep this "remote" remote?
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
请参考 远程设置文档 ,了解如何在没有互联网浏览器的机器上进行设置。
请注意,rclone 会在你的本地机器上运行一个 Web 服务器,用于收集 Citrix ShareFile 返回的令牌。这个 Web 服务器仅在打开浏览器到你获取到验证码的这段时间内运行。它的地址是 http://127.0.0.1:53682/
,如果你正在运行主机防火墙,可能需要临时解除对该地址的封锁。
配置完成后,你可以像下面这样使用 rclone
:
列出你的 ShareFile 顶级目录
rclone lsd remote:
列出你的 ShareFile 中的所有文件
rclone ls remote:
将本地目录复制到名为 backup 的 ShareFile 目录
rclone copy /home/source remote:backup
路径可以按需设置深度,例如 remote:directory/subdirectory
。
修改时间和哈希值
ShareFile 允许将对象的修改时间精确设置到 1 秒。这些修改时间将用于检测对象是否需要同步。
ShareFile 支持 MD5 类型的哈希值,因此你可以使用 --checksum
标志。
传输
对于超过 128 MiB 的文件,rclone 将使用分块传输。rclone 会同时上传多达 --transfers
个分块(所有多部分上传共享)。分块会被缓存在内存中,通常大小为 64 MiB,因此增加 --transfers
会增加内存使用。
受限文件名字符
除了 默认受限字符集 之外,以下字符也会被替换:
字符 | 编码值 | 替换字符 |
---|---|---|
\ | 0x5C | \ |
* | 0x2A | * |
< | 0x3C | < |
> | 0x3E | > |
? | 0x3F | ? |
: | 0x3A | : |
| | 0x7C | | |
" | 0x22 | " |
文件名也不能以以下字符开头或结尾。只有当这些字符是文件名的第一个或最后一个字符时才会被替换:
字符 | 编码值 | 替换字符 |
---|---|---|
SP | 0x20 | ␠ |
. | 0x2E | . |
无效的 UTF - 8 字节也会被 替换,因为它们不能用于 JSON 字符串。
标准选项
以下是特定于 ShareFile(Citrix ShareFile)的标准选项。
–sharefile-client-id
OAuth 客户端 ID。
通常留空。
属性:
- 配置项:client_id
- 环境变量:RCLONE_SHAREFILE_CLIENT_ID
- 类型:字符串
- 是否必需:否
–sharefile-client-secret
OAuth 客户端密钥。
通常留空。
属性:
- 配置项:client_secret
- 环境变量:RCLONE_SHAREFILE_CLIENT_SECRET
- 类型:字符串
- 是否必需:否
–sharefile-root-folder-id
根文件夹的 ID。
留空以访问“个人文件夹”。你可以使用这里的标准值之一,或者任何文件夹 ID(长十六进制数字 ID)。
属性:
- 配置项:root_folder_id
- 环境变量:RCLONE_SHAREFILE_ROOT_FOLDER_ID
- 类型:字符串
- 是否必需:否
- 示例:
- ""
- 访问个人文件夹(默认)。
- “favorites”
- 访问收藏夹文件夹。
- “allshared”
- 访问所有共享文件夹。
- “connectors”
- 访问所有单独的连接器。
- “top”
- 访问主页、收藏夹和共享文件夹以及连接器。
- ""
高级选项
以下是特定于 ShareFile(Citrix ShareFile)的高级选项。
–sharefile-token
OAuth 访问令牌,以 JSON 格式存储。
属性:
- 配置项:token
- 环境变量:RCLONE_SHAREFILE_TOKEN
- 类型:字符串
- 是否必需:否
–sharefile-auth-url
认证服务器 URL。
留空以使用提供商的默认值。
属性:
- 配置项:auth_url
- 环境变量:RCLONE_SHAREFILE_AUTH_URL
- 类型:字符串
- 是否必需:否
–sharefile-token-url
令牌服务器 URL。
留空以使用提供商的默认值。
属性:
- 配置项:token_url
- 环境变量:RCLONE_SHAREFILE_TOKEN_URL
- 类型:字符串
- 是否必需:否
–sharefile-client-credentials
使用客户端凭证 OAuth 流程。
这将使用 RFC 6749 中描述的 OAUTH2 客户端凭证流程。
属性:
- 配置项:client_credentials
- 环境变量:RCLONE_SHAREFILE_CLIENT_CREDENTIALS
- 类型:布尔值
- 默认值:false
–sharefile-upload-cutoff
切换到多部分上传的阈值。
属性:
- 配置项:upload_cutoff
- 环境变量:RCLONE_SHAREFILE_UPLOAD_CUTOFF
- 类型:SizeSuffix
- 默认值:128Mi
–sharefile-chunk-size
上传分块大小。
必须是 2 的幂且 >= 256k。
增大此值将提高性能,但请注意,每个分块在每次传输时都会被缓存在内存中。
减小此值将减少内存使用,但会降低性能。
属性:
- 配置项:chunk_size
- 环境变量:RCLONE_SHAREFILE_CHUNK_SIZE
- 类型:SizeSuffix
- 默认值:64Mi
–sharefile-endpoint
API 调用的端点。
这通常在 OAuth 过程中自动发现,但可以手动设置为类似如下的地址:https://XXX.sharefile.com
属性:
- 配置项:endpoint
- 环境变量:RCLONE_SHAREFILE_ENDPOINT
- 类型:字符串
- 是否必需:否
–sharefile-encoding
后端的编码方式。
有关更多信息,请参阅 概述中的编码部分。
属性:
- 配置项:encoding
- 环境变量:RCLONE_SHAREFILE_ENCODING
- 类型:Encoding
- 默认值:Slash,LtGt,DoubleQuote,Colon,Question,Asterisk,Pipe,BackSlash,Ctl,LeftSpace,LeftPeriod,RightSpace,RightPeriod,InvalidUtf8,Dot
–sharefile-description
远程存储的描述。
属性:
- 配置项:description
- 环境变量:RCLONE_SHAREFILE_DESCRIPTION
- 类型:字符串
- 是否必需:否
限制
请注意,ShareFile 不区分大小写,因此你不能同时拥有名为 “Hello.doc” 和 “hello.doc” 的文件。
ShareFile 仅支持长度不超过 256 个字符的文件名。
Citrix ShareFile 后端不支持 rclone about
命令。没有此功能的后端无法确定 rclone 挂载的可用空间,也不能在 rclone 联合远程存储中使用 mfs
(最大可用空间)策略。