您的位置:首页 > 运维架构 > Linux

Linux开机自动挂载Windows主机共享文件

2016-02-16 16:45 926 查看
windows主机ip:10.17.128.101

共享文件夹:shared

用户名:nobody

密码:123456

挂载到Linux中的目录/mnt/shared中:

mount -t cifs -o username=nobody,password=123456 //10.17.128.101/shared /mnt/shared


这种命令只是单次的,重启之后会失效,想要开机自动挂载,有两种方法:

第一种:

vi /etc/rc.d/rc.local
在末尾添加:
mount -t cifs -o username=nobody,password=123456 //10.17.128.101/shared /mnt/shared
保存后使之为可执行文件:
chmod +x /etc/rc.d/rc.local


第二种(没验证过):

vi /etc/fstab
在末尾添加:
//10.17.128.101/shared   /mnt/shared cifs  auto,username=‘nobody’,password=‘123456’  0 0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息