温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

linux挂在Windows操作系统共享文件夹

发布时间:2020-07-16 15:44:30 来源:网络 阅读:2263 作者:lrq110120 栏目:系统运维

一、准备Windows的共享目录

    建立一个文件夹启用匿名访问,在Linux挂载的时候输入密码的时候可以随便输入。

linux挂在Windows操作系统共享文件夹

二、挂载目录到Linux系统

mount -t cifc "windows共享文件夹的路径" "linux /mnt路径"

例如

mkdir /windows

mount -t cifs //192.168.1.10/linuxshare /windows

Linux 会要求输入访问Windows 共享文件夹上的密码。

linux挂在Windows操作系统共享文件夹



下面是根据用户权限设置的共享文件夹

  1. 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. 

    说明远程共享文件夹路径不存在。请仔细检查,并更正目录路径。

    linux挂在Windows操作系统共享文件夹

  2. 2

    mount -t cifc "windows共享文件夹" "Linux /mnt路径"

    i.e. mount -t cifs //16.187.190.50/test /mnt/

    注意:

    Linux中提示:

    mount error(13): Permission denied

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

    解决方案:将访问Windows共享目录的用户名和密码直接加入到命令中。

    linux挂在Windows操作系统共享文件夹

  3. 3

    mount -t cifs -o username=WindowsLogin,password="passwordinWindows"

     //16.187.190.50/test /mnt/

    注意:该命令中,username为windows上的用户;password为window用户对应的密码

    linux挂在Windows操作系统共享文件夹

  4. 4

    步骤3的命令也可以使用以下方式实现:

    mount.cifs -o username="Administrator",password="PasswordForWindows" //16.187.190.50/test /mnt/

    linux挂在Windows操作系统共享文件夹

  5. 5

    通过步骤3和步骤4可以成功将windows共享文件夹挂载在/mnt目录下。不过由于mount命令只能由root权限用户使用。其挂载文件夹的默认owner和group都为root,并且不能通过chmod命令更改权限。

    linux挂在Windows操作系统共享文件夹

  6. 6

    使用mount命令,给挂载共享文件夹指定owner和group.

    mount.cifs -o username="Administrator",password="PasswordForWindows",uid=Mysa,gid=Mysa //16.187.190.50/test /mnt/

    linux挂在Windows操作系统共享文件夹

  7. 7

    检查/mnt/中文件夹的owner和group。

    linux挂在Windows操作系统共享文件夹

  8. 8

    更改文件夹权限。给mount共享文件夹所在组的写权限。

    mount.cifs -o username="Administrator",password="PasswordForWindows",Mysa,gid=Mysa,dir_mode=0777 //16.187.190.50/test /mnt/

    linux挂在Windows操作系统共享文件夹

    linux挂在Windows操作系统共享文件夹



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI