Linux挂载Windows文件夹

# sudo mount -t \
-o user=username \ //Windows用户名
-o uid=myname \ //Linux用户名
-o gid=users \
-o defaults \
$mount_source \  //share/src_dir
$mount_point \ //dest_dir
-o nounix \
-o noserverino

输入密码(Windows登录密码)挂载

举例

#!/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=zhangxuechao

#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
posted @ 2017-05-09 09:53  thomas_blog  阅读(159)  评论(0编辑  收藏  举报