# sudo mount -t cifs \
-o user=username \ //Windows用户名
-o uid=myname,password=pass \ //Linux用户名,密码
-o gid=users \
-o defaults \
$mount_source \ //share/src_dir
$mount_point \ //dest_dir
-o nounix \
-o noserverino
举例
#!/bin/bash
#before mount,you should set the 4 item below
#1.your chian domain account,eg *wx*****
mount_user=china/ThomasZhang
#2.you account for linux
myname=zxc
#3.the dir you shared on your windows machine,the ip is windows ip
mount_source=//share/hg_10.0
#4.the path on linux
mount_point=/home/$myname/hg_10.0
if [ ! -d $mount_point ] ; then
echo "create directory $mount_point"
mkdir -p $mount_point
fi
sudo mount -t cifs \
-o user=$mount_user \
-o uid=$myname \
-o gid=users \
-o defaults \
$mount_source \
$mount_point \
-o nounix \
-o noserverino
if [ $? = 0 ] ; then
echo "success mount to $mount_point :-)"
exit 0
else
echo "mount $mount_source fail."
exit 1
fi
报错
mount: /mnt: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
解决办法:
apt-get install cifs-utils
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)