ubuntu 挂载windows共享目录的方法

本文详细介绍如何在Windows中设置共享文件夹,并通过Linux系统进行挂载。包括配置步骤、解决权限拒绝错误的方法及自动挂载设置。

建立windows共享目录

右击要共享的文件夹-->属性-->高级共享-->添加用户-->添加完全控制权限

假设建立的共享地址为\\192.168.1.100\Linux

获取当前登录user的gid,uid

id username

建立挂载目录

mkdir /mnt/win

挂载目录

 sudo mount -t cifs //192.168.1.100/Linux /mnt/win -o username=,password=,gid=,uid=

其中username,password为windows共享目录添加的账号和密码

如果出现错误:

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

则在挂载参数后面加上sec=ntlm,或者sec=ntlmssp

username=,password=,gid=,uid=,sec=ntlm

原因如下:

"sec" is the security mode and determines how passwords are encrypted between server and client ( even if you don't require passwords ).

ntlm used to be the default which is why you never had to specify it discretely. Things have moved on however so the default is now ntlmssp. If you are accessing something which doesn't speak ntlmssp you have to override the new default with the old one.

Most NAS devices use older technology so they often require ntlm. If you access an OSX samba share however it requires ntlmssp so before you had to specify that in the mount options but now you don't.

 

查看挂载目录

df -h

自动挂载共享目录

每次启动都来挂载很麻烦?可以让系统每次启动时就自动挂载

编辑/etc/fstab

sudo vi /etc/fstab

在最后添加一行

//192.168.1.100/Linux /mnt/win cifs username=,password=,gid=,uid=,auto 0 0

重启一下看看

sudo shutdown -r 0
df -h

成功了~

 

转载于:https://www.cnblogs.com/windchen/p/6236299.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值