天天看点

配置yum库及samba服务匿名访问

实验要求

将目录 /usr/src 共享给所有人

共享名设为 tools

允许所有人访问、无需密码验证

访问权限为只读

1、安装软件包

[root@localhost ~]# rpm -q samba-client samba samba-common //查看软件包是否安装

package samba-client is not installed

package samba is not installed

package samba-common is not installed

安装的软件包有依赖包的话,可采用配置yum库方式安装

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# cp rhel-debuginfo.repo rhel- server.repo

[root@localhost yum.repos.d]# vim rhel-server.repo //编辑yum库

[rhel-server]  //要唯一    

name=Red Hat Enterprise Linux Server //yum库名字

baseurl=file:///misc/cd/Server  //rpm包所在的目录,也可采用http、ftp共享路径

enabled=1 //是否开启,0为关闭、1为开启

gpgcheck=1 //是否需要检查key,防盗版软件

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release //key所对应的文件

[root@localhost yum.repos.d]# yum clean all //清空缓存

[root@localhost yum.repos.d]# yum -y install samba samba-client  samba-common //安装软件包

2、修改主配置文件

[root@ser1 ~]# vim /etc/samba/smb.conf

...

74         workgroup = WORKGROUP  //工作组名称

75         server string = Win File Ser //服务器描述

89         log file = ar/log/samba/%m.log  //日志路径,%m对应客户机地址

91         max log size = 50  //日志最大容量(KB)

101         security = share //默认使用的安全级别(share为匿名共享,user为用户认证)

289 [tools]

290         comment = tools Public //对此共享目录的说明文字

291         path = /usr/src  //共享目录的实际位置

292         public = yes //是否所有人可用,等效于guset ok

293         read only = yes  //是否所有人可读(write list 为可读写)

3、启动服务

[root@ser1 ~]# testparm

[root@ser1 ~]# service smb restart

[root@ser1 ~]# chkconfig smb on

[root@ser1 ~]# netstat -anptu | grep mbd  //查看所有和TCP和UDP的端口和进程信息以数字的形式显示出来

tcp    0  0 0.0.0.0:139    0.0.0.0:*      LISTEN      7008/smbd    

tcp    0  0 0.0.0.0:445    0.0.0.0:*      LISTEN      7008/smbd    

udp    0  0 192.168.10.10:137     0.0.0.0:*           7011/nmbd    

udp    0  0 0.0.0.0:137           0.0.0.0:*           7011/nmbd    

udp    0  0 192.168.10.10:138     0.0.0.0:*           7011/nmbd    

udp    0  0 0.0.0.0:138           0.0.0.0:*            7011/nmbd  

4、客户端测试: