当前位置:首页 » 《随便一记》 » 正文

Linux挂载WebDav盘

16 人参与  2024年04月25日 15:05  分类 : 《随便一记》  评论

点击全文阅读


九术AI

Linux挂载WebDav盘

简单挂载

安装davfs2工具

# CentOSyum install davfs2# Ubuntu/Debianapt install davfs2

挂载 WebDAV 磁盘

先在 Linux 系统上创建个要挂载的文件目录,再挂WebDAV到本地目录,和平时挂载U盘形式一样

mkdir /cloudmount -t davfs https://pan.cloud.com/dav /cloud

然后输入账号密码即可。

开机自动挂载在WebDAV

普通挂载后,重启就会发现通过 WebDAV 挂载的磁盘没有了,也就意味着你每次重启 Linux 系统,都需要重新挂载,这时候需要更改几个设置来实现开机自动挂载。

第一步、编辑davfs2.conf配置文件,将use_locks1改为0

vim /etc/davfs2/davfs2.conf
# davfs2 configuration file 2012-07-19# version 9# ------------------------------------# Copyright (C) 2006, 2007, 2008, 2009, 2012 Werner Baumann# Copying and distribution of this file, with or without modification, are# permitted in any medium without royalty provided the copyright notice# and this notice are preserved.# Please read the davfs2.conf (5) man page for a description of the# configuration options and syntax rules.# Available options and default values# ====================================# General Options# ---------------# dav_user        davfs2            # system wide config file only# dav_group       davfs2            # system wide config file only# kernel_fs       fuse# buf_size        16                 # KiByte# WebDAV Related Options# ----------------------# use_proxy       1                 # system wide config file only# proxy                             # system wide config file only# servercert# clientcert# secrets         ~/.davfs2/secrets # user config file only# ask_auth        1use_locks       0# lock_owner      <user-name># lock_timeout    1800              # seconds# lock_refresh    60                # seconds# use_expect100   0# if_match_bug    0# drop_weak_etags 0# allow_cookie    0# precheck        1# ignore_dav_header 0# server_charset# connect_timeout 10                # seconds# read_timeout    30                # seconds# retry           30                # seconds# max_retry       300               # seconds# add_header# Cache Related Options# ---------------------# backup_dir      lost+found# cache_dir       /var/cache/davfs2 # system wide cache#                 ~/.davfs2/cache   # per user cache# cache_size      50                # MiByte# table_size      1024# dir_refresh     60                # seconds# file_refresh    1                 # second# delay_upload    10# gui_optimize    0# Debugging Options# -----------------# debug           # possible values: config, kernel, cache, http, xml,                  #      httpauth, locks, ssl, httpbody, secrets, most

第二步、修改secrets文件,添加账号信息

vim /etc/davfs2/secrets

在底部添加账号信息,如

https://pan.cloud.com/dav user password

第三步、添加开机挂载命令

vim /etc/rc.local

末尾添加挂载命令,和挂在U盘一样

mount -t davfs https://pan.cloud.com/dav /cloud

重启即可自动挂载。

最后一步、测试

进入挂载路径,查看是否已经存在文件

注意事项

1. 开机没有自动挂载

如果开机没有自动挂载,有可能是rc.local文件没有权限,需要先执行chmod +x /etc/rc.local再重启系统。WebDAV服务商网络连接质量好的话,使用将非常顺滑,而且不占用本地磁盘空间。国外的VPS可以使用国外的知名的云盘运营商,他们的链路质量相对比较优秀,国内的大部分野鸡云也会提供该选项,但是有跑路的风险,无论如何,这羊毛是可以试试的

2. 成功mount后,不能看到webdav本身的文件内容

原因是 webdav 进程无法访问 lost+found 目录。直接把这个目录删除就解决了


点击全文阅读


本文链接:http://zhangshiyu.com/post/100058.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1