• 运维经验记录 在CentOS上挂载Windows共享磁盘


    1、需求:

    非root用户(普通用户)能够读写windows共享目录,比如查看文件、创建文件、修改文件、删除文件

    # 让普通用户也可以正常读写
    uid=value and gid=value
    Set the owner and group of the root of the file system (default: uid=gid=0, but with option uid or gid without specified value, the uid and gid of the current process are taken).
    
    • 1
    • 2
    • 3

    2、挂载步骤

    先在 Windows 下面共享需要挂载的目录

    指定需要共享的文件目录:Downloads

    右键》共享》网络文件和文件夹共享》共享…》选择要与其共享的用户》默认用户即可

    右键》共享》高级共享》高级共享…》勾选共享些文件夹

    右键》共享》高级共享》高级共享…》权限》为指定用户赋予完全控制权限
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    3、在linux普通用户下,创建挂载与windows共享一一对应的挂载目录

    mkdir -p ~/windows-downloads
    
    • 1

    4、查看当前用户uid和gid

    cat /etc/passwd |grep xxx
    cat /etc/group|grep users
    
    • 1
    • 2

    5、挂载命令

    sudo mount -t cifs -o uid=1000,gid=100,username=xxx,password=xxxxxx 
    //10.239.15.119/Users/xxx/Downloads /home/xxx/windows-downloads
    
    • 1
    • 2

    6、查挂载在状态

    # df -h
    文件系统                               容量  已用  可用 已用% 挂载点
    //x.x.x.x/Users/xxx/Downloads  466G   58G  408G   13% /home/xxx/windows-downloads
    
    • 1
    • 2
    • 3

    在这里插入图片描述

  • 相关阅读:
    5 Flink CDC同步
    python代码的几种常见加密方式
    vscode如何格式化超大型JS代码
    流程图如何制作?好用的11款流程图软件盘点!
    docker运维之自定义网络配置
    Stellar Toolkit for MySQL 9.0 Crack 3in1
    Docker项目部署
    简易线程池实现
    Spring中的IOC控制Mybatis案例
    Linux服务器移动文件命令
  • 原文地址:https://blog.csdn.net/withkai44/article/details/132775497