安装和尝试挂载
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:
提示server does not support WebDAV错误
指令
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开机挂载
开机启动自动挂载
dibian9及更早:添加/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/挂载目录
debian10-12:修改FSTAB
nano /etc/fstab
增加挂载指令后保存
https://username.stackstorage.com/remote.php/webdav /www/wwwroot/挂载目录/ davfs defaults 0 0
文章评论