Fedora8中Samba服务的配置

[root@localhost ~]#rpm -q samba
[root@localhost ~]# find /media/Fedora\ 8\ i386\ DVD/Packages/ -name "*samba*"
/media/Fedora 8 i386 DVD/Packages/samba-3.0.26a-6.fc8.i386.rpm
/media/Fedora 8 i386 DVD/Packages/samba-client-3.0.26a-6.fc8.i386.rpm
/media/Fedora 8 i386 DVD/Packages/samba-common-3.0.26a-6.fc8.i386.rpm
/media/Fedora 8 i386 DVD/Packages/system-config-samba-1.2.58-1.fc8.noarch.rpm
1.关闭放火墙
  iptables -F
2.设置selinux
SELinux有利也有弊,就算你有root的权限,也不可以乱来.
SELinux(Security-Enhanced Linux) 是美国国家安全局(NAS)对于强制访问控制的实现,是 Linux® 上最杰出的新安全子系统。NSA是在Linux社区的帮助下开发了一种访问控制体系,在这种访问控制体系的限制下,进程只能访问那些在他的任务中所需要文件。SELinux 默认安装在 Fedora 和 Red Hat Enterprise Linux 上,也可以作为其他发行版上容易安装的包得到。
SELinux就如防火墙, Fedora Core 2开始是系统预设了,但是关闭的。FC3是部分开启。
FC5全部开启了。
SELINUX有「disabled」「permissive」,「enforcing」3种选择。
Disabled就不用说了,permissive就是Selinux有效,但是即使你违反了策略的话它让你继续操作,但是把你的违反的内容记录下来。在我们开发策略的时候非常的有用。
相当于Debug模式。
Enforcing就是你违反了策略,你就无法继续操作下去。
/etc/selinux
[root@localhost selinux]# vi config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted
# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
3.修改目录权限
[root@localhost opt]# cd /
[root@localhost /]# cd /opt/
[root@localhost opt]# mkdir jw
[root@localhost opt]# ll
总计 4
drwxr-xr-x 2 root root 4096 05-17 04:33 jw
[root@localhost opt]# chmod 777 jw
[root@localhost opt]# ll
总计 4
drwxrwxrwx 2 root root 4096 05-17 04:33 jw
配置共享级别(share)samba
文件说明
workgroup = MSHOME 将linux 加入的工作组名,我这里加入了MSHOME工作组。
server string = Samba 这是服务器描述信息,方便标志资源。可以随便输入
security = user 共享的安全级别,samba有四种安全等级:
share:用户不需要账户及密码即可登录samba服务器
user:由提供服务的samba服务器负责检查账户及密码(默认)
server:检查账户及密码的工作由另一台windows或samba服务器负责
domain:指定windows域控制服务器来验证用户的账户及密码)
[root@localhost samba]# pwd
/etc/samba
# ----------------------- Standalone Server Options ------------------------
security = share
[Tux]
        path=/opt/jw   注:设置共享信息,随便输入
        writable=yes   注:用户是否可写,这里我们允许
        guest ok=yes
        ;browseable=yes
[root@localhost /]# /etc/rc.d/init.d/smb start
启动 SMB 服务:                                            [确定]
[root@localhost /]# /etc/rc.d/init.d/smb stop
关闭 SMB 服务:                                            [确定]
******************************************************************************************
配置用户级别(user)samba
[root@localhost samba]# vi smb.conf
# ----------------------- Standalone Server Options ------------------------
security = user
[Tux]
        comment=This is my samba server!  注:设置共享信息,随便输入
        path=/opt/jw
        valid users=test   注:可以访问次共享目录的用户,我这里设为testuser用户
        writable=yes
        ;guest ok=yes
[root@localhost samba]# /etc/rc.d/init.d/smb restart
关闭 SMB 服务:                                            [确定]
启动 SMB 服务:                                            [确定]
建立一个系统用户
[root@localhost samba]# useradd test
[root@localhost samba]# passwd test
Changing password for user test.
新的 UNIX 口令:
重新输入新的 UNIX 口令:
passwd: all authentication tokens updated successfully.
更新/etc/samba/smbpasswd文件
[root@localhost samba]# cat /etc/passwd | mksmbpasswd.sh>/etc/samba/smbpasswd
[root@localhost samba]# ls
lmhosts  smb.conf  smb.conf.bak  smbpasswd  smbusers
然后创建samba帐户
[root@localhost samba]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Added user test.

猜你喜欢

转载自unixtux.iteye.com/blog/1600623