Linux挂载Windows文件夹

来源:互联网 发布:系统策划 知乎 编辑:程序博客网 时间:2024/06/07 01:57
# 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 linuxmyname=zhangxuechao#3.the dir you shared on your windows machine,the ip is windows ipmount_source=//share/hg_10.0#4.the path on linuxmount_point=/home/$myname/hg_10.0if [ ! -d $mount_point ] ; thenecho "create directory $mount_point"mkdir -p $mount_pointfisudo 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 ] ; thenecho "success mount to $mount_point :-)"exit 0elseecho "mount $mount_source fail."exit 1fi
1 0