(一}建立本地要共享的目录

root@wees:~# mkdir /a/share -p

修改权限

chmod 777 -R /a/share

(二}修改配置文件

vi /etc/samba/smb.conf +

按o按键可以直接增加新行

然后在尾部加入

[share]
      path =/a/share
      available = yes
      browsealbe = yes
      public= no
      writable = yes

(三}建立用户

useradd a

smbpasswd -a a

建立好帐号和密码

(四}启动

root@wees:~/Desktop# /etc/init.d/samba restart


(五}连接到共享

查看本地ip地址

root@wees:~# ifconfig 
eth0      Link encap:Ethernet  HWaddr 94:de:80:a9:ae:fb  
          inet addr:192.168.5.139  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::96de:80ff:fea9:aefb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:208618 errors:0 dropped:0 overruns:0 frame:0
          TX packets:174046 errors:0 dropped:6 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:263858475 (251.6 MiB)  TX bytes:21724890 (20.7 MiB)


windows下测试

\\192.168.5.139

输入刚才的帐号和密码就可以了


linux下测试挂载目录

创建挂载的目录

root@wees:~# mkdir /a/cifs -p

root@wees:~/Desktop# mount -t cifs  -o   username=a,password=a  //192.168.5.139/share /a/cifs/

查看下目录

ls -an /a/cifs/


转载地址:http://blog.csdn.net/cyuyan112233/article/details/44496155