设置CIFS共享开机自动挂载

1. linux主机自动挂载cifs

方法一:/etc/fstab中添加挂载项

vim /etc/fstab
添加挂载项,如下:

方法二:/etc/rc.local中添加挂载命令

mount -t cifs -o username=user1,password=111111 //10.1.2.31/smb /mnt/smb

2. windows主机自动挂载cifs

编写xxx.bat文件

@echo off
net use y: \\10.1.1.31\smb "111111" /user:"user1"
其中,y为网络驱动器盘符,111111为登录用户的密码,user1为登录用户
将该文件放至目录C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup下,重启即可自动挂载。
ps:可能有隐藏目录,需要在文件“查看”属性中勾选“隐藏的项目”,如下:

 

参考:windows自动重连网络驱动器 https://blog.csdn.net/xiexingshishu/article/details/42081543

posted on 2019-07-24 20:56  seabiscuit0922  阅读(5207)  评论(0编辑  收藏  举报

导航