mount -t cifc "windows共享mountdir4boot 文件夹夹" "Linux /mnt路径" 后cp 与直接用ftp,谁快?

Linux上挂载Samba(Windows & macOS共享文件夹)的正确姿势 - 简书
Linux上挂载Samba(Windows & macOS共享文件夹)的正确姿势
操作环境服务器:Windows 7家庭版的PC,macOS 10.12.4的MacBook Pro客户端:CentOS 7 1611,已安装好cifs-utils软件包
先使用smbclient查看服务器共享出来的资源
在Linux命令行界面中,必须手动指定贡献出来的资源,不像Windows以及macOS可以自动列出。smbclient命令用法 smbclient -L &服务器IP或主机名&
以Windows 7为例,macOS用法一样
[root: ~]# smbclient -L 192.168.100.2 -U zenandidi
Enter zenandidi's password:
#输入密码,不回显
Domain=[WIN7] OS=[Windows 7 Home Basic 7601 Service Pack 1] Server=[Windows 7 Home Basic 6.1]
#共享点名称#
Connection to 192.168.100.2 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available #可能会出现一些错误警告,不过可以列出的话就不用管
上面列出来的表格就是共享点信息,下面将连接“C”这个共享点。
出错了怎么办?
如果执行完上面的命令后出现Server does not support EXTENDED_SECURITY
but 'client use spnego = yes and 'client ntlmv2 auth = yes'那么说明服务器不支持扩展性安全认证,通常出现在Windows XP这种古董身上,需要在/etc/samba/smb.conf文件前面加上下面两行:
client use spnego = yes
client ntlmv2 auth = no
使用mount或mount.cifs挂载服务器共享资源
mount命令用法 mount -t cifs &共享点路径& &挂载点& -o username=&用户名&
mount.cifs命令用法 mount.cifs &共享点路径& &挂载点& -o username=&用户名&
Windows和macOS的挂载姿势有点不一样,请注意区别。
以下均使用mount命令
挂载windows的共享资源
[root: ~]# mount -t cifs //192.168.100.2/C /mnt/smb -o username=zenandidi
#如果共享点带空格,请在空格前加上 “ \ ”
Password for zenandidi@//192.168.100.2/C:
******************
如果没显示任何错误,说明挂载成功。下面检查一下挂载点。
[root: ~]# mount | grep cifs
//192.168.100.2/C on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=zenandidi,domain=WIN7,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.100.2,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
[root: ~]# ls /mnt/smb
$Recycle.Bin
BaiduNetdiskDownload
new_zxjt_v6
System Volume Information
ProgramData
Documents and Settings
Program Files
Program Files (x86)
目录以及文件可以正常显示,说明挂载已成功。
挂载macOS的共享资源
如果使用以上方法挂载macOS上的共享资源,发现挂载点下一片空白。
[root: ~]# mount -t cifs //192.168.100.3/Macintosh\ HD /mnt/smb -o username=zenandidi
Password for zenandidi@//192.168.100.3/Macintosh HD:
******************
[root: ~]# ls /mnt/smb/
#什么都没有啊
嗯,一定是哪里出了问题。用journal -xe看一下日志。
4月 25 16:35:42 CentOS kernel: CIFS VFS: Send error in QFSUnixInfo = -95
4月 25 16:35:42 CentOS kernel: CIFS VFS: server does not support POSIX extensions
4月 25 16:35:42 CentOS kernel: CIFS VFS: server does not support POSIX extensions
4月 25 16:35:59 CentOS kernel: CIFS VFS: Autodisabling the use of server inode numbers on //192.168.100.3/Macintosh HD. This server doesn't seem to support them properly. Hardlinks will not be recognized on this mount. Consider mounting with the "noserverino" option to silence this message.
果然是有问题,好像是说不支持硬链接什么的,可以加一个noserverino选项忽略错误。查了下文档
noserverinoClient generates inode numbers itself rather than using the actual ones from the server.
意思大概是说加了这个选项之后客户端使用自己的inode号而不使用服务器提供的inode号。
毕竟samba这个协议的亲妈是Windows,而Windows中的文件系统没有inode这个概念,来到Unix文件系统上多少还是有些水土不服的。
好吧,那就按照提示添加noserverino选项吧。
[root: ~]# mount -t cifs //192.168.100.3/Macintosh\ HD /mnt/smb -o username=zenandidi,noserverino
Password for zenandidi@//192.168.100.3/Macintosh HD:
******************
[root: ~]# ls /mnt/smb/
Applications
installer.failurerequests
好了,挂载成功了!
如果samba服务器是Windows系统的话,挂载的正确姿势为
mount -t cifs &共享点路径& &挂载点& -o username=&用户名&或mount.cifs &共享点路径& &挂载点& -o username=&用户名&
如果samba服务器是macOS系统的话,挂载的正确姿势为
mount -t cifs &共享点路径& &挂载点& -o username=&用户名&,noserverino或mount.cifs &共享点路径& &挂载点& -o username=&用户名&,noserverino
如果依然出错,可以按照日志的指引进行配置文件的更改,实在不行再上网求助。
开机自动挂载方法
在/etc/fstab末尾添加
&共享点路径&
username=&用户名&,password=&密码&
这里不在赘述,选项也跟上面一样,就是把文件系统的类型改为cifs还有把密码输进里面。个人不建议修改这个文件,如果断网挂载失败的话,会进入救援模式,比较麻烦。我的做法是把挂载命令写进/etc/rc.d/rc.loacl文件中。
余泽楠~超喜欢Linux服务器系统和计算机网络,都是兴趣而已!温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
mount -t cifc "windows共享文件夹" "Linux /mnt路径"i.e. mount -t cifs //16.187.190.60/test /mnt/Linux 会要求输入访问Windows 共享文件夹上的密码。注意:Linux中提示:Unable to find suitable address.&说明远程共享文件夹路径不存在。请仔细检查,并更正目录路径。mount -t cifc "windows共享文件夹" "Linux /mnt路径"i.e. mount -t cifs //16.187.190.50/test /mnt/注意:Linux中提示:mount error(13): Permission deniedRefer to the mount.cifs(8) manual page (e.g. man mount.cifs)解决方案:将访问Windows共享目录的用户名和密码直接加入到命令中。mount -t cifs -o username=WindowsLogin,password="passwordinWindows"&//16.187.190.50/test /mnt/注意:该命令中,username为windows上的用户;password为window用户对应的密码步骤3的命令也可以使用以下方式实现:mount.cifs -o username="Administrator",password="PasswordForWindows" //16.187.190.50/test /mnt/通过步骤3和步骤4可以成功将windows共享文件夹挂载在/mnt目录下。不过由于mount命令只能由root权限用户使用。其挂载文件夹的默认owner和group都为root,并且不能通过chmod命令更改权限。使用mount命令,给挂载共享文件夹指定owner和group.mount.cifs -o username="Administrator",password="PasswordForWindows",uid=Mysa,gid=Mysa //16.187.190.50/test /mnt/检查/mnt/中文件夹的owner和group。更改文件夹权限。给mount共享文件夹所在组的写权限。mount.cifs -o username="Administrator",password="PasswordForWindows",Mysa,gid=Mysa,dir_mode=0777 //16.187.190.50/test /mnt/
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Linux mount 命令挂载 Windows 共享文件夹',
blogAbstract:'mount -t cifc \"windows共享文件夹\" \"Linux /mnt路径\"i.e. mount -t cifs //16.187.190.60/test /mnt/Linux 会要求输入访问Windows 共享文件夹上的密码。注意:Linux中提示:Unable to find suitable address.&说明远程共享文件夹路径不存在。请仔细检查,并更正目录路径。',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:3,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}出现麻烦了
输入字符串的格式不正确。}

我要回帖

更多关于 mount挂载共享文件夹 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信