----------------------------------------------------------
第一种方案
=====================================
1.安装davfs2:
apt-get install davfs2 -y 2.配置davfs2: 在/etc/davfs2/secrets中添加如下一行即可: "http://127.0.0.1:9001/" admin admin 3.挂载到本地磁盘: mount.davfs http://127.0.0.1:9001/ /home ----------------------------------------------------------第二种方案
=====================================
安装和尝试挂载
apt-get install davfs2 mkdir /www/wwwroot/挂载目录 mount -t davfs https://username.stackstorage.com/remote.php/webdav /www/wwwroot/挂载目录 #Please enter the username to authenticate with server #https://username.stackstorage.com/remote.php/webdav or hit enter for none. Username: test #Please enter the password to authenticate user test with server #https://username.stackstorage.com/remote.php/webdav or hit enter for none. Password:
指令
df -h
显示如下挂载成功
设置指定账户,方便挂载
首先启用用户锁,操作方式如下:
vi /etc/davfs2/davfs2.conf
找到“use_locks”,去掉前面的 # 然后把 1 改为 0 后保存。
然后再修改帐密文件,操作方式如下:
echo "https://username.stackstorage.com/remote.php/webdav username password" > /etc/davfs2/secrets
然后 umount /挂载目录 把刚刚挂载的分区卸载掉,然后直接再次挂载的时候就无需密码了。
debian9开机挂载
添加/etc/rc.local
为了解决这个问题,我们需要手工添加一个 /etc/rc.local 文件
cat <<EOF >/etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. EOF
赋予权限
chmod +x /etc/rc.local
启动 rc-local 服务
systemctl start rc-local
添加命令启动
mount -t davfs https://username.stackstorage.com/remote.php/webdav /www/wwwroot/挂载目录
----------------------------------------------------------
第三种方案
=====================================
一、最简单的挂载支持WebDav的网盘
1、安装davfs2
Ubuntu/Debian下
apt-get install davfs2
CentOS下
yum install davfs2
2、创建目录并挂载
mkdir /novos mount -t davfs https://brick.novos.be/remote.php/dav/files/账号/ /novos
输入账号、密码即可。
二、进阶用法
1、创建一个用户,用于davfs2
usermod -aG davfs2 用户名
2、创建需要挂载的目录和个人配置文件目录
mkdir ~/novos mkdir ~/.davfs2
复制配置文件
cp /etc/davfs2/secrets ~/.davfs2/secrets
3、设置用户权限(改为自己的用户名)
chown : ~/.davfs2/secrets chmod 600 ~/.davfs2/secrets
编辑 ~/.davfs2/secrets ,输入WebDav网盘信息,如:
https://brick.novos.be/remote.php/dav/files/账号/ 用户名 密码
建议在 /etc/davfs2/secrets 也添加上
4、添加mount信息到 /etc/fstab
https://brick.novos.be/remote.php/dav/files/账号/ /root/novos davfs user,rw,auto 0 0
5、使用
添加
mount ~/novos
卸载
umount ~/novos标签:Web,secrets,davfs2,etc,DAV,https,挂载,novos,Debian From: https://www.cnblogs.com/merrynuts/p/17578915.html