网络存储的访问一般有两种方式,API访问(包括对应的命令行工具及程序),本地挂载访问.本文档主要介绍本地挂载访问.
smb
mount -t cifs -o "rw,dir_mode=0644,file_mode=0644,username=username,password=yourpassword" //192.168.1.100/yourshare_folder_name /usr/local/your_server_folder
nas(nfs)
mount -t nfs 192.168.1.38:/NFS /mnt/NFStest
ftp
步骤1:
sudo apt-get install curlftpfs
步骤2:
sudo curlftpfs -o codepage=gbk ftp://username:password@192.168.0.2 /mnt/nas
dav
以坚果云为例
步骤1:
sudo apt-get install davfs2
步骤2:
sudo usermod -a -G davfs2 leic
reboot //重启生效
步骤3:
编辑/etc/fstab文件
https://dav.jianguoyun.com/dav/ /home/username/webdav davfs user,noauto,uid=username,file_mode=600,dir_mode=700 0 1
步骤4:
配置帐号和密码
mkdir ~/.davfs2/
echo "https://dav.jianguoyun.com/dav/ webdavuser webdavpassword" >> ~/.davfs2/secrets
chmod 0600 ~/.davfs2/secrets
步骤5:
mount ~/webdav //挂载
fusermount -u ~/webdav //取消挂载
问题
-
提示不支持webdav
➜ ~ mount /home/xxx/Tools/dav /sbin/mount.davfs: mounting failed; the server does not support WebDAV
解决方式
修改配置文件
sudo vim /etc/davfs2/davfs2.conf
修改内容
# use_expect100 0 # if_match_bug 0 # drop_weak_etags 0 # n_cookies 0 # precheck 1 - # ignore_dav_header 0 + ignore_dav_header 1 # use_compression 0 # min_propset 0
-
无法复制剪切
修改配置文件
sudo vim /etc/davfs2/davfs2.conf
修改内容
# trust_server_cert
# clientcert
# secrets ~/.davfs2/secrets # user config file only
# ask_auth 1
- # use_locks 1
+ use_locks 0
# lock_owner <user-name>
# lock_timeout 1800 # seconds
# lock_refresh 60 # seconds
# use_expect100 0
网友评论