• Linux 挂载windows目录


    1.默认情况下,Linux服务器会装有samba-client,但是没有装samba-server。但是访问Windows系统共享,安装有samba-client就可以了。

    [root@test ~]# rpm -qa | grep samba
    samba-3.6.23-14.el6_6.x86_64
    samba-client-3.6.23-14.el6_6.x86_64
    samba-common-3.6.23-14.el6_6.x86_64
    samba-winbind-clients-3.6.23-14.el6_6.x86_64
    samba-swat-3.6.23-14.el6_6.x86_64
    samba-winbind-devel-3.6.23-14.el6_6.x86_64
    samba-winbind-3.6.23-14.el6_6.x86_64
    samba-winbind-krb5-locator-3.6.23-14.el6_6.x86_64

    如果不存在就安装samba

    [root@test ~]# yum -y install samba

    2.检查是否有安装

    [root@test ~]# rpm -qa | grep  cifs-utils

    [root@test ~]# yum -y install cifs-utils

    3.挂载目录

    假设Windows的IP为192.168.1.106共享目录为C://Intel,则其共享地址为192.168.1.106/Intel。

    挂在方法:

    mount -t cifs //192.168.1.106/intel /mnt -o username='jsme',password='312'

    此处username和password都是Windows主机的用户名和密码,该方法为root用户使用,挂载后owner和group都为root且挂在后目录不能用chmod修改目录权限

    mount -t cifs //192.168.2.26/device /mnt/share -o username=share,password=share,rw,file_mode=0777,dir_mode=0777,setuid=509,setgid=101

    其中,uid=509, gid=101是一个普通用户dba /mnt/share权限位是0777,所有用户有完全访问权限

    卸载方法:

    umount /mnt

    ------------------------------------------------------------------------------------------

    以上方法立即生效但是在Linux主机重启后失效,永久生效方法为

    修改/etc/fstab文件,文件最后加入:

    //192.168.1.106/Inetl  /mnt cifs  username=‘jsme’,password=‘312’ ,rw  0 0

    或在文件/etc/rc.local添加

    mount -t cifs //192.168.1.106/intel /mnt -o username='jsme',password='312'

  • 相关阅读:
    luoguP2016 战略游戏
    [Usaco2006 Nov]Corn Fields牧场的安排
    [Ahoi2009]self 同类分布
    POJ3208:Apocalypse Someday
    [usaco2010 Oct]Soda Machine
    [Usaco2005 Dec]Scales 天平
    PTA的Python练习题(十九)
    堆叠注入
    PHP序列化与反序列化(三)总结实战
    攻防世界web进阶1-12总结篇
  • 原文地址:https://www.cnblogs.com/GNblog/p/8259363.html
Copyright © 2020-2023  润新知