您现在的位置是:首页 >学无止境 >【解决】linux 使用rclone 挂载alist到自己本地磁盘报错网站首页学无止境

【解决】linux 使用rclone 挂载alist到自己本地磁盘报错

kai__csdn 2025-03-25 12:01:01
简介【解决】linux 使用rclone 挂载alist到自己本地磁盘报错

【解决】linux 使用rclone 挂载alist到自己本地磁盘报错

 ERROR : : error listing: couldn't list files: 403 Forbidden
 NOTICE: Failed to lsd with 2 errors: last error was: couldn't list files: 403 Forbidden

这个错误通常是由于没有为 admin 账户赋予 webdav 权限导致的。

1. 检查 Alist 配置

首先,确保在 Alist 中已经为 admin 用户启用了 webdav 权限。如果没有启用,请按照以下步骤操作:

  1. 登录 Alist 管理界面。
  2. 进入用户管理页面,找到 admin 用户。
  3. 确保 webdav 权限已启用。
2. 配置 rclone

接下来,我们需要配置 rclone 以正确连接 Alist 的 WebDAV 服务。以下是配置步骤:

  1. 打开终端,输入以下命令进入 rclone 配置界面:

    rclone config
    
  2. 选择编辑现有的远程配置(如果已经存在),或者创建一个新的远程配置。假设我们选择编辑现有的 netdisk 远程配置:

    e) Edit existing remote
    n) New remote
    d) Delete remote
    r) Rename remote
    c) Copy remote
    s) Set configuration password
    q) Quit config
    e/n/d/r/c/s/q> e
    
  3. 选择要编辑的远程配置:

    Select remote.
    Choose a number from below, or type in an existing value.
     1 > netdisk
    remote> 1
    
  4. 修改 urluserpass 等选项。确保 url 指向正确的 Alist WebDAV 地址,userpass 是 Alist 中具有 webdav 权限的用户名和密码:

    Option url.
    URL of http host to connect to.
    E.g. https://example.com.
    Enter a value of type string. Press Enter for the default (http://192.168.1.121:5244/dav).
    url> http://192.168.1.121:5244/dav
    
    Option user.
    User name.
    In case NTLM authentication is used, the username should be in the format 'DomainUser'.
    Enter a value of type string. Press Enter for the default (admin).
    user> admin2
    
    Option pass.
    Password.
    Choose an alternative below. Press Enter for the default (n).
    y) Yes, type in my own password
    g) Generate random password
    n) No, keep existing (default)
    y/g/n> y
    Enter the password:
    password:
    Confirm the password:
    password:
    
  5. 完成配置后,保存并退出:

    Configuration complete.
    Options:
    - type: webdav
    - url: http://192.168.1.121:5244/dav
    - vendor: other
    - user: admin2
    - pass: *** ENCRYPTED ***
    Keep this "netdisk" remote?
    y) Yes this is OK (default)
    e) Edit this remote
    d) Delete this remote
    y/e/d> y
    
  6. 退出 rclone 配置界面:

    e/n/d/r/c/s/q> q
    
3. 测试连接

配置完成后,可以使用以下命令测试连接:

rclone lsd netdisk:

如果配置正确,你应该能够看到 Alist 中的文件列表,例如:

          -1 2025-02-08 12:21:22        -1 test
          -1 2025-02-07 18:17:08        -1 aliyun
          -1 2025-02-08 12:11:24        -1 haoo
4. 挂载到本地磁盘

最后,你可以使用 rclone mount 命令将 Alist 挂载到本地磁盘:

rclone mount netdisk: /path/to/mount/point &

请将 /path/to/mount/point 替换为你希望挂载的本地目录。

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。