免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2376 | 回复: 6
打印 上一主题 下一主题

samba配置问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-04-20 16:26 |只看该作者 |倒序浏览
本帖最后由 anonymous0502 于 2012-04-20 16:26 编辑

/etc/samba/smb.conf文件如下:

[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
    netbios name = smbtestserver
        log file = /var/log/samba/%m.log
        max log size = 5000
        security = user
    encrypt passwords = yes
    smb passwd file = /etc/samba/smbpasswd
    dns proxy = no
    name resolve order = lmhosts bcast host
        load printers = yes
        cups options = raw
idmap uid = 1000000-2000000
idmap gid = 1000000-2000000
template shell = /bin/false
winbind use default domain = no
[smbshare]
    comment = test share
    path = /sambashare
    read only = no
    public = yes
    writable = yes
    valid users = apple
    create mode =0664
    directory mode = 0775

testparm看到的结果总是不对,security = user的设置总是无效,为什么?

[root@server501 ~]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[smbshare]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        netbios name = SMBTESTSERVER
        server string = Samba Server Version %v
        log file = /var/log/samba/%m.log
        name resolve order = lmhosts bcast host
        dns proxy = No
        idmap uid = 1000000-2000000
        idmap gid = 1000000-2000000
        cups options = raw

[smbshare]
        comment = test share
        path = /sambashare
        valid users = apple
        read only = No
        create mask = 0664
        directory mask = 0775
        guest ok = Yes

论坛徽章:
0
2 [报告]
发表于 2012-04-20 18:21 |只看该作者
请问LZ,你这个配置是不是原配?木有改过???

论坛徽章:
0
3 [报告]
发表于 2012-04-20 19:06 |只看该作者
13466852695 发表于 2012-04-20 18:21
请问LZ,你这个配置是不是原配?木有改过???

谢谢,有点眉目了,以前记的在rhel4上做的笔记写得不清不楚,自己折腾了一阵心里有点数了,但是仍然有其他疑问,还得继续google一阵{:2_166:}

论坛徽章:
0
4 [报告]
发表于 2012-04-20 19:32 |只看该作者
本帖最后由 anonymous0502 于 2012-04-20 19:36 编辑

以前从没注意到这个地方:
为什么smb.conf设置了security = user,但是smbclient -L时还是不需要用户和口令就可以查看到部分信息呢?
在windows上是会弹出对话框要求输入用户和口令了的
这个本来就是这么设计的?
  1. [apple@server501 ~]$ smbclient -L //server501
  2. Password:
  3. [b]Anonymous login successful[/b]
  4. Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.28-0.el5.8]

  5.         Sharename       Type      Comment
  6.         ---------       ----      -------
  7.         IPC$            IPC       IPC Service (Samba Server Version 3.0.28-0.el5.8)
  8. Anonymous login successful
  9. Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.28-0.el5.8]

  10.         Server               Comment
  11.         ---------            -------
  12.         SERVER501            Samba Server Version 3.0.28-0.el5.8

  13.         Workgroup            Master
  14.         ---------            -------
  15.         MYGROUP              SERVER501
复制代码

论坛徽章:
0
5 [报告]
发表于 2012-04-20 19:42 |只看该作者
这好像本来就是这样子的{:2_166:}
我已经把samba-common重新安装过了,用的--replacepkgs,被我改动过的文件已经被我移位了。rpm -V已经显示复原如初了。
只是这个结果跟我以前想的有点不同

[root@server501 samba]# rpm -qf /etc/samba/smb.conf
samba-common-3.0.28-0.el5.8
[root@server501 samba]# rpm -V samba-common
[root@server501 samba]# grep -v -E '^\s*#|^\s*;|^\s*$' smb.conf
[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        security = user
        passdb backend = tdbsam
        load printers = yes
        cups options = raw
[homes]
        comment = Home Directories
        browseable = no
        writable = yes
[printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = no
        guest ok = no
        writable = no
        printable = yes
[root@server501 samba]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        passdb backend = tdbsam
        cups options = raw

[homes]
        comment = Home Directories
        read only = No
        browseable = No

[printers]
        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No
[root@server501 samba]#


论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
6 [报告]
发表于 2012-05-26 15:06 |只看该作者

  1. 以前的笔记供您参考!

  2. > cat samba.txt
  3. # Samba
  4. # CIFS(Common Internet File System)
  5. # NetBIOS(Network Basic Input/Output System)
  6. /etc/samba/smb.conf
  7. /etc/samba/smbpasswd
  8. /etc/samba/smbusers

  9. /usr/bin/testparm
  10. /usr/bin/smbstatus
  11. /usr/bin/smbpasswd
  12. /usr/bin/smbclient
  13. /usr/bin/nmblookup
  14. /usr/bin/smbtree
  15. nmbd        (UDP:137,138port)
  16. smbd        (TCP:139,445port)
  17. samba samba-common samba-client
  18. chkconfig smb on
  19. service smb restart
  20. # ATTENTION: the 'security context' should be changed as follow ~!Oops..
  21. chcon -Rvt samba_share_t /shared/

  22. dumpe2fs -h /dev/sda5
  23. vim /etc/fstab
  24. LABEL=/1 ext3 defaults,acl 1 1
  25. mount -o remount,acl /
  26. # 1>: Group Control
  27. setfacl -m d:g:groupname:rwx /shared
  28. getfacl /shared
  29. mask+actual permission = effective permission
  30. # 2>: User Control
  31. chown jacky:jacky /shared        (Control only one user)

  32. smbpasswd -a jacky
  33. cat /etc/samba/smbpasswd
  34. smbpasswd -d jacky
  35. smbpasswd -e jacky

  36. smbclient //192.168.0.12/shared -U jacky
  37. smbclient -L //127.0.0.1 -U user%password
  38. mount -t cifs //station12/shared /mnt -o username=jacky,password=jacky
  39. # AutoMounter for Samba
  40. chkconfig autofs on
  41. service autofs restart
  42. vim /etc/auto.master
  43. /home        /etc/auto.samba        --timeout=60
  44. cp /etc/auto.misc /etc/auto.samba
  45. vim /etc/auto.samba
  46. samba        -fstype=cifs,username=?,password=?        ://192.168.1.4/shared

  47. # User Home's Access Control
  48. getsebool -a | grep samba
  49. setsebool -P samba_enable_home_dirs=1
  50. service smb restart

  51. cat /etc/sysconfig/i18n
  52. LANG="en_US.UTF-8"
复制代码

论坛徽章:
3
IT运维版块每日发帖之星
日期:2015-12-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-19 06:20:00每日论坛发贴之星
日期:2016-01-19 06:20:00
7 [报告]
发表于 2013-03-15 08:34 |只看该作者
linux samba服务器验证的时候windows却之用guest去登陆,这是不是linux那配置错了,还是windows问题。

  



您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP