Linux挂载Windows共享

简介:

在Linux下挂载Windows共享出现一个奇怪的问题:

1
2
3
mount  -t cifs -o username=bak,password=bak  //192 .168.10.3 /f $ /backup/  /backup/
提示
mount //192 .168.10.3 /f $ /backup/  is not a valid block device

但是

1
mount  -t cifs -o username=bak,password=bak  //192 .168.10.3 /f /backup/

就是正常的。


其实这是因为Linux默认无法识别cifs,需要安装cifs-utils

1
2
yum -y  install  cifs-utils
mount  -t cifs -o username=bak,password=bak  //192 .168.10.3 /f $ /backup/  /backup/

这个时候就可以正常挂载了。


这个时候修改/etc/fstab,增加(以下是只读挂载)

1
2
3
4
5
//192 .168.10.3 /f $ /backup  /backup  cifs    ro,username=bak,password=bak   1  2
 
 
可写挂载
//192 .168.10.3 /f $ /backup  /backup  cifs    rw,username=bak,password=bak   1  2

如果需要指定某个用户权限的话

1
//192 .168.10.3 /f $ /backup  /backup  cifs    rw,username=bak,password=bak,uid=500,gid=800   1  2

指定用户gid和uid


出现的错误信息及处理:

一、挂载时,用户/密码错误

mount error(13): Permission denied

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

/var/log/message信息


Oct 12 16:20:01 localhost kernel: Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE

Oct 12 16:20:01 localhost kernel: CIFS VFS: Send error in SessSetup = -13

Oct 12 16:20:01 localhost kernel: CIFS VFS: cifs_mount failed w/return code = -13

二、没有分享目录

Retrying with upper case share name

mount error(6): No such device or address

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

查看/var/log/message记录

Oct 12 16:20:06 localhost kernel: CIFS VFS: cifs_mount failed w/return code = -6

Oct 12 16:20:17 localhost kernel: CIFS VFS: cifs_mount failed w/return code = -6

Oct 12 16:20:17 localhost kernel: CIFS VFS: cifs_mount failed w/return code = -6


注意:如果是数字开头比如我在windows下的共享目录为

\\192.168.2.10\102\public  手动mount挂载是可以的,但是放在/etc/fstab是不行,默认会被转义。

因此最好的方法就是使用//192.168.2.10/102/public去配置



本文转自 rong341233 51CTO博客,原文链接:http://blog.51cto.com/fengwan/1837210


相关文章
|
10天前
|
Linux 数据安全/隐私保护 Windows
Linux共享Windows目录
Linux共享Windows目录
|
10天前
|
Unix Linux Ruby
在windows和linux上高效快捷地发布Dash应用
在windows和linux上高效快捷地发布Dash应用
|
10天前
|
Linux iOS开发 开发者
跨平台开发不再难:.NET Core如何让你的应用在Windows、Linux、macOS上自如游走?
【8月更文挑战第28天】本文提供了一份详尽的.NET跨平台开发指南,涵盖.NET Core简介、环境配置、项目结构、代码编写、依赖管理、构建与测试、部署及容器化等多个方面,帮助开发者掌握关键技术与最佳实践,充分利用.NET Core实现高效、便捷的跨平台应用开发与部署。
45 3
|
10天前
|
Ubuntu Linux 虚拟化
安装Windows Linux 子系统的方法:适用于windows 11 版本
本文提供了在Windows 11系统上安装Linux子系统(WSL)的详细步骤,包括启用子系统和虚拟化功能、从Microsoft Store安装Linux发行版、设置WSL默认版本、安装WSL2补丁,以及完成Ubuntu的首次安装设置。
42 2
|
10天前
|
Ubuntu Linux
内核实验(四):Qemu调试Linux内核,实现NFS挂载
本文介绍了在Qemu虚拟机中配置NFS挂载的过程,包括服务端的NFS服务器安装、配置和启动,客户端的DHCP脚本添加和开机脚本修改,以及在Qemu中挂载NFS、测试连通性和解决挂载失败的方法。
23 0
内核实验(四):Qemu调试Linux内核,实现NFS挂载
|
5天前
|
Linux 网络虚拟化 Windows
ccproxy windows上用的代理软件(类似linux系统上的squid)
ccproxy windows上用的代理软件(类似linux系统上的squid)
|
9天前
|
Linux Windows Python
最新 Windows\Linux 后台运行程序注解
本文介绍了在Windows和Linux系统后台运行程序的方法,包括Linux系统中使用nohup命令和ps命令查看进程,以及Windows系统中通过编写bat文件和使用PowerShell启动隐藏窗口的程序,确保即使退出命令行界面程序也继续在后台运行。
|
12天前
|
算法 Linux 索引
Linux0.11 根文件系统挂载(四)
Linux0.11 根文件系统挂载(四)
9 0
|
13天前
|
存储 Linux Windows
【应用服务 App Service】App Service For Windows 如何挂载Storage Account File Share 示例
【应用服务 App Service】App Service For Windows 如何挂载Storage Account File Share 示例
|
Web App开发 安全 Linux
下一篇
DDNS