SMB服务配置过程

SMB
服务器
1. [root@all Server]# vim /etc/samba/smb.conf   主配置文件
    workgroup = MYGROUP
   
    [homes]     用户主目录
        comment = Home Directories   描述
        browseable = no              正常不可以看到
        writable = yes               可写
        valid users = %S             合法用户
        valid users = MYDOMAIN\%S
      [public]
       comment = Public Stuff
       path = /home/samba    共享路径
       public = yes
       writable = yes
       printable = no
       write list = a      a用户可写
      
2.  [root@all Server]# service smb restart    重启服务
3.   [root@all ~]# useradd a
    [root@all ~]# passwd a
    Changing password for user a.
    New UNIX password:
    BAD PASSWORD: it is WAY too short
    Retype new UNIX password:
    passwd: all authentication tokens updated successfully.
4.  [root@all ~]# smbpasswd -a a    添加SMB用户(主要为windows使用)
    New SMB password:
    Retype new SMB password:
    Added user a.
 
客户端
1. [root@all ~]# smbclient -L 192.168.0.242 -U a%a  %后面的a为密码
Domain=[AA-11] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
        Sharename       Type      Comment
        ---------       ----      -------
        C$              Disk      默认共享
        share           Disk     
        IPC$            IPC       远程 IPC
        ADMIN$          Disk      远程管理
session request to 192.168.0.242 failed (Called name not present)
session request to 192 failed (Called name not present)
Domain=[AA-11] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
        Server               Comment
        ---------            -------
        Workgroup            Master
        ---------            -------
2.  [root@xx ~]# mount.cifs //192.168.0.242/c$ /mnt -o username=administrator,password=cctv,codepage=cp936
    挂载C$到/mnt
3.  [root@dx ~]# smbtree   查看局域网内的主机
    Password:    密码可以没有表示匿名.
    WORKGROUP
        \\WWW-2BDC9200AAD
       
    [root@dx ~]# nmblookup WWW-2BDC9200AAD  查看主机NETBIOS信息.
      querying WWW-2BDC9200AAD on 192.168.1.255
      192.168.1.103 WWW-2BDC9200AAD<00>
     [root@dx ~]# nmblookup \*   *表示查看局域网所有主机. \表示转译.
querying * on 192.168.1.255
192.168.1.109 *<00>
192.168.1.103 *<00>
4.   挂载.
     [root@dx ~]# mount -o username=administrator,password=cctv //192.168.1.240/aa /mnt
     或者.[root@dx ~]# mount -o username=administrator%cctv //192.168.1.240/aa /mnt

你可能感兴趣的:(职场,休闲,smb)