Aliyunpan Webdav

aliyundrive-webdav:

aliyundrive-webdav 1.3.1

WebDAV server for AliyunDrive

USAGE:
    aliyundrive-webdav [OPTIONS]

OPTIONS:
        --cache-size <CACHE_SIZE>
            Directory entries cache size [default: 1000]
   
   --cache-ttl <CACHE_TTL>
        Directory entries cache expiration time in seconds [default: 600]

    --debug
        Enable debug log

    --domain-id <DOMAIN_ID>
        Aliyun PDS domain id

-h, --help
        Print help information

    --host <HOST>
        Listen host [env: HOST=] [default: 0.0.0.0]

-I, --auto-index
        Automatically generate index.html

    --no-trash
        Delete file permanently instead of trashing it

-p, --port <PORT>
        Listen port [env: PORT=] [default: 8080]

-r, --refresh-token <REFRESH_TOKEN>
        Aliyun drive refresh token [env: REFRESH_TOKEN=]

    --read-only
        Enable read only mode

    --root <ROOT>
        Root directory path [default: /]

-S, --read-buffer-size <READ_BUFFER_SIZE>
        Read/download buffer size in bytes, defaults to 10MB [default: 10485760]

    --tls-cert <TLS_CERT>
        TLS certificate file path [env: TLS_CERT=]

    --tls-key <TLS_KEY>
        TLS private key file path [env: TLS_KEY=]

-U, --auth-user <AUTH_USER>
        WebDAV authentication username [env: WEBDAV_AUTH_USER=]

-V, --version
        Print version information

-w, --workdir <WORKDIR>
        Working directory, refresh_token will be stored in there if specified

-W, --auth-password <AUTH_PASSWORD>
        WebDAV authentication password [env: WEBDAV_AUTH_PASSWORD=]

Test in Terminal:

1
2
3
4
5
6
7
aliyundrive-webdav \
--host localhost \
--port 8080 \
--auth-user admin \
--auth-password admin \
--workdir ~/.config/aliyunpan-webdav \
--refresh-token 8371210d17a24925b232e250b435041d

Daemonize Aliyundrive WebDAV:

1, Codes below in aliyundrive-webdav.sh saved at /usr/local/sbin

1
2
3
4
5
6
7
aliyundrive-webdav \
--host localhost \
--port 8080 \
--auth-user admin \
--auth-password admin \
--workdir ~/.config/aliyunpan-webdav \
--refresh-token 8371210d17a24925b232e250b435041d

2, Create system service aliyundrive-webdav-bash.service at /etc/systemd/system with codes below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description=aliyundrive webDAV Service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/bin/bash /usr/local/sbin/aliyundrive-webdav.sh

[Install]
WantedBy=multi-user.target

rclone:

after run rclone config

1
/root/.config/rclone/rclone.conf

Test:

1
2
3
4
5
sudo rclone mount aliyundrive-webdav:/ /home/shawn/aliyundrive \
--cache-dir /home/shawn/cache \
--vfs-cache-mode writes \
--allow-non-empty \
--allow-other

Note:

--allow-other is needed,

because you just used sudo to run rclone. Other uses cannot access the files without “allow other”

Daemonize Rclone:

1, Codes below in rclone-mount.sh saved at /usr/local/sbin

1
2
3
4
5
6
/usr/bin/rclone \
mount aliyundrive-webdav:/ /home/shawn/aliyundrive \
--cache-dir /home/shawn/cache \
--vfs-cache-mode writes \
--allow-non-empty \
--allow-other

2, Create system service rclone-mount.service at /etc/systemd/system with codes below:

1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=rclone Mount aliyundrive webDAV
After=network-online.target

[Service]
Type=simple
ExecStart=/bin/bash /usr/local/sbin/rclone-mount.sh
Restart=on-abort
User=root

[Install]
WantedBy=default.target

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!