手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

RHCE_RHEL6_实战精品 5.samba服务器

[日期:2012-08-19] 来源:Linux公社  作者:yjc118 [字体:大 中 小]

企业需求:

配置samba服务器,工作组名为RHCE,认证类型为user,共享/RedHat/storage目录,共享名称为share,能被浏览到。该共享目录允许sisi用户有写权限,密码为sisiuser。

仅允许在dn.ws.com域访问该目录,其他用户均为只读。

实施步骤:

1.安装必要的samba服务包。

[root@dtop30 ~]# rpm -qa |grep samba

[root@dtop30 ~]# yum -y install samba

[root@dtop30 ~]# chkconfig smb on

[root@dtop30 ~]# service smb start

2.添加samba用户

[root@dtop30 ~]# grep /etc/passwd  首先sisi必须在系统中存在,不存在,请先创建。

[root@dtop30 ~]# useradd sisi

[root@dtop30 ~]# smbpasswd -a sisi 添加sisi为samba用户

New SMB password:sisiuser

Retype new  SMB password:sisiuser

Added user sisi.

[root@dtop30 ~]#

3.创建共享目录/redhat/storage,并设置权限。

[root@dtop30 ~]# mkdir -p /redhat/storage

[root@dtop30 ~]# chmod 755 /redhat/storage

[root@dtop30 ~]# setfacl -m u:sisi:rwx /redhat/storage

[root@dtop30 ~]# getfacl /redhat/storage

4.验证sisi可写入的权限。

[root@dtop30 ~]# su - sisi

[sisi@dtop30 ~]$ touch /redhat/storage/sisi.txt

[root@dtop30 ~]$ exit

[root@dtop30 ~]#

5.设置正确的selinux上下文。

[root@dtop30 ~]# semanage fcontext -a -t samba_share_t '/redhat(/.*)?'

[root@dtop30 ~]# restorecon -vFR /redhat/

[root@dtop30 ~]# ls -lZd /redhat/storage

RHCE_RHEL6_实战精品 5.samba服务器

6.编辑/etc/samba/smb.conf

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

RHCE_RHEL6_实战精品 5.samba服务器

RHCE_RHEL6_实战精品 5.samba服务器这是默认的,可不用改

[root@dtop30 ~]# testparm      可以用这条命令测试配置文件。

linux
相关资讯      
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款