加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

linux下samba的使用(一)无需密码进入

(2014-02-15 17:37:07)
标签:

it

分类: Linux
转载自鸟哥的私房菜网站
Samba 所需软件:samba、samba-client、samba-common
不需密码的分享 (security = share)
1. 设定 smb.conf 配置文件
[root@www ~]# cd /etc/samba
[root@www samba]# cp smb.conf smb.conf.raw  <==先备份再说!
[root@www samba]# vim smb.conf
# 1. 先设定好服务器整体环境方面的参数
[global]
       # 与主机名有关的设定信息
        workgroup     = vbirdhouse
        netbios name  = vbirdserver
        server string = This is vbird's samba server

        # 与语系方面有关的设定项目喔,为何如此设定请参考前面的说明
        unix charset    = utf8
        display charset = utf8
        dos charset     = cp950

        # 与登录文件有关的设定项目,注意变量 (%m)
        log file = /var/log/samba/log.%m
        max log size = 50
        # 这是与密码有关的设定项目哩!
        security = share
# 2. 分享的资源设定方面:主要得将旧的批注,新的加入!
   先取消 [homes], [printers] 的项目,然后针对 /tmp 的设定,可浏览且可写入喔
[temp]                                     <==分享资源名称
        comment    = Temporary file space  <==简单的解释此资源
        path       = /tmp                  <==实际 Linux 分享的目录
        writable   = yes                   <==是否可写入?在此例为是的
        browseable = yes                   <==能不能被浏览到资源名称
        guest ok   = yes  
2. 用 testparm 查阅 smb.conf 的语法设定正确性
[root@www ~]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[temp]"   <==看有几个中括号,若中刮号前出现讯息,则有错误
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions <==按 Enter 继续
3. 服务器端的服务启动与埠口观察
[root@www ~]# /etc/init.d/smb start  <==这一版开始要启动两个daemon
[root@www ~]# /etc/init.d/nmb start
[root@www ~]# chkconfig smb on
[root@www ~]# chkconfig nmb on
4. 假设自我为客户端的检验 (默认用 lo 接口)
[root@www ~]# smbclient -L //127.0.0.1
Enter root's password: <==因为不需要密码,因此这里单击 [Enter] 吧!
Domain=[VBIRDHOUSE] OS=[Unix] Server=[Samba 3.5.4-68.el6_0.2]

        Sharename       Type      Comment
        ---------       ----      -------
        temp            Disk      Temporary file space
        IPC$            IPC       IPC Service (This is vbird's samba server)
Domain=[VBIRDHOUSE] OS=[Unix] Server=[Samba 3.5.4-68.el6_0.2]

        Server               Comment
        ---------            -------
        VBIRDSERVER          This is vbird's samba server

        Workgroup            Master
        ---------            -------
        VBIRDHOUSE           VBIRDSERVER
[root@www ~]# mount -t cifs //127.0.0.1/temp /mnt
Password: <==因为没有密码,所以这里还是按 Enter 即可
[root@www ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
....(前面省略)....
//127.0.0.1/temp/      1007896     53688    903008   6% /mnt

[root@www ~]# cd /mnt
[root@www mnt]# ll  <==以上这两个动作要进行!才会知道有没有权限的问题!
[root@www mnt]# touch zzz
[root@www mnt]# ll zzz /tmp/zzz
-rw-r--r--. 1 nobody nobody 0 Jul 29 13:08 /tmp/zzz
-rw-r--r--. 1 nobody nobody 0 Jul 29 13:08 zzz
# 注意喔!你进入 /mnt 身份会被压缩成为 nobody 呢!不再是 root 啊!

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有