Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2244272
  • 博文数量: 395
  • 博客积分: 10994
  • 博客等级: 上将
  • 技术积分: 5586
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-17 19:49
文章存档

2014年(1)

2013年(10)

2012年(74)

2011年(303)

2010年(7)

分类: LINUX

2011-06-15 12:47:16

linux samb器安装

 

下面有2方法,第一没有成功,不知道为啥?写下来(都是在在centos下操作,不知道redhat中的效果会怎样)

一。使用用户访问权

步骤如下,只贴过程代

[root@bogon ~]# vi /etc/samba/smb.conf

....

...  

    245 

    246 #============================ Share Definitions ========================        ======

    247 

    248 [homes] 

    249         comment = Home Directories

    250         browseable = no

    251         writable = yes

    252 ;       valid users = %S

    253 ;       valid users = MYDOMAIN\%S

    254 

    255 [printers]

    256         comment = All Printers

    257         path = /var/spool/samba

....

....

 

6yy后的内容是

 246 #============================ Share Definitions ========================        ======

    247 

    248 [homes] 

    249         comment = Home Directories

    250         browseable = no

    251         writable = yes

    252 ;       valid users = %S

    253 ;       valid users = MYDOMAIN\%S

    254 

    255 [homes]

    256         comment = Home Directories

    257         browseable = no

    258         writable = yes

    259 ;       valid users = %S

    260 ;       valid users = MYDOMAIN\%S

    261 [printers]

    262         comment = All Printers

修改后的内容如下:

  247 

    248 [homes] 

    249         comment = Home Directories

    250         browseable = no

    251         writable = yes

    252 ;       valid users = %S

    253 ;       valid users = MYDOMAIN\%S

    254 

    255 [My_samba_share]

    256         comment = My share  Directories

    257         browseable = yes

    258         path = /

    259         writable = yes

    260         valid users = smb

    261 ;       valid users = MYDOMAIN\%S

    262 [printers]

    263         comment = All Printers

....

[root@bogon ~]# useradd smb

[root@bogon ~]# smbpasswd -a smb

New SMB password:

Retype new SMB password:

[root@bogon ~]# /etc/init.d/sm

smartd  smb     

[root@bogon ~]# /etc/init.d/smb restart

关闭 SMB                                             [确定]

关闭 NMB                                             [确定]

SMB                                             [确定]

NMB                                             [确定]

[root@bogon ~]#  ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:A4:32:F5  

          inet addr:59.70.157.174  Bcast:59.70.157.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fea4:32f5/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:61413 errors:0 dropped:0 overruns:0 frame:0

          TX packets:68848 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:8772511 (8.3 MiB)  TX bytes:45745899 (43.6 MiB)

          Interrupt:19 Base address:0x2000 

 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:78 errors:0 dropped:0 overruns:0 frame:0

          TX packets:78 errifconfig

下面贴出windows下访问samb的图片,解释一下为什么没有成功(就是列出现象)

 

 

看到了吧,上面出现了我的那个My_samb-share了

 

上面的是里面的内容,因为设置的共享目录是/,所以说是根目录下的所有目录

 

 

问题就出现在这:我在windows下复制一个文件到这里面,确不允许,我很郁闷,最终也没有解决。。。按原理说这种方法这个地方时最重要的。。。。

 

但是smb用户里面的内容却是可以复制和被复制,以及粘贴的。。。。?

 

 

 

 

 

 

 

二。第二方法,个是立共享文件目方法

[root@bogon ~]# vi /etc/samba/smb.conf

 280 # A publicly accessible directory, but read only, except for people in

    281 # the "staff" group

    282 ;       [public]

    283 ;       comment = Public Stuff

    284 ;       path = /home/samba

    285 ;       public = yes

    286 ;       writable = yes

    287 ;       printable = no

    288 ;       write list = +staff

:set nu

修改后如下:

280 # A publicly accessible directory, but read only, except for people in

    281 # the "staff" group

    282         [public]

    283         comment = Public Stuff

    284         path = /home/samba

    285         public = yes

    286         writable = yes

    287         printable = no

    288         write list = +staff

:set nu

[root@bogon ~]# /etc/init.d/smb restart

关闭 SMB                                             [确定]

关闭 NMB                                             [确定]

SMB                                             [确定]

NMB                                             [确定]

[root@bogon ~]# 

 

同样,在进行下一步之前还需添加smb用户(在第一部中已经说明了。。)

 

 

上面这一步中有时会出现“无任何网络提供程序接受指定的网络路径”的问题,这个时候,你应该设置linux的防护墙了:setup对samb设置允许访问即可。。。

 

 

 

想共享目录下复制一个图片,效果如下:

 

[root@bogon ~]# cd /home/samba/

[root@bogon samba]# ls

u=1989224260,2758866535&fm=0&gp=0[1].jpg //看到了吧,出现了,呵呵

[root@bogon samba]# 

 

 

[root@bogon samba]# ls  //删除了以后没了

[root@bogon samba]# 

 

总结:以上2中方法,第一种应该是比较常见的,因为设置共享目录是/目录,在网上也有很多是这样弄的,可是我弄不好,也不知道为什么,估计也是差一步吧

但是第二种方法已经成功了,我喜欢在字符界面操作,这样的话也满足了我的要求了,呵呵

阅读(1350) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~