欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

在Linux上使用webdav进行挂载

最编程 2024-08-15 08:05:28
...

有docker建议直接使用docker:

docker run -itd  \
    --name mydav \
    --device /dev/fuse \
    --cap-add SYS_ADMIN \
    --security-opt "apparmor=unconfined" \
    --env "WEBDRIVE_USERNAME=用户名" \
    --env "WEBDRIVE_PASSWORD=密码" \
    --env "WEBDRIVE_URL=http://172.17.0.5:48080/remote.php/dav/files/eric/" \
    --env "DAVFS2_ASK_AUTH=0" \
    -v /mnt/dav:/mnt/webdrive:rshared \
    efrecon/webdav-client
	

安装所需软件包:apt-get install davfs2 -y

创建挂载目录:mkdir /mnt/dav

挂载:mount -t davfs -o noexec https://nextcloud.example.com/remote.php/webdav/ /mnt/dav/

卸载:umount /mnt/dav

保存账号密码:

cat << EOF | sudo tee -a /etc/davfs2/secrets
# personal webdav, nextcloud application password
/mnt/dav milosz mypassword
# older versions used URL, it is equivalent for compatibility reasons
#https://nextcloud.example.com/remote.php/webdav/ milosz mypassword
EOF

开机自动挂载:

cat << EOF | sudo tee -a /etc/fstab

# personal webdav
https://nextcloud.example.com/remote.php/webdav/ /mnt/dav davfs _netdev,noauto,user,uid=milosz,gid=milosz 0 0
EOF