Samba安装详细步骤

1检查Samba服务包是否已安装

rpm -qa | grep samba

[root@nutch vmware-tools-distrib]# rpm -qa | grep samba

samba-winbind-clients-3.6.9-169.el6_5.x86_64

samba4-libs-4.0.0-58.el6.rc4.x86_64

samba-3.6.9-169.el6_5.x86_64

samba-client-3.6.9-169.el6_5.x86_64

samba-common-3.6.9-169.el6_5.x86_64

samba-winbind-3.6.9-169.el6_5.x86_64

2、安装samba

 [root@roothomes ~] yum install samba

3、重启samba

[root@nutch vmware-tools-distrib]# service smb restart

关闭 SMB 服务:                                            [确定]

启动 SMB 服务:                                            [确定]

You have new mail in /var/spool/mail/root

如果重启出错,则先关闭samba

Service smb stop

再启动samba

Service smb start

4、配置smb.conf

备份smb.conf

[root@nutch vmware-tools-distrib]# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

配置smb.conf

[root@nutch 桌面]# vi /etc/samba/smb.conf

[global]

workgroup=WORKGROUP

server string=Samba Server

security=share

netbios name=SambaServer

 

[share]

comment = SambaServer

path = /home

public = yes

writables = yes

only guest = yes

 

5、重启samba

6、验证配置是否成功

Linux中访问

[root@nutch 桌面]# smbclient //192.168.232.140/share

WARNING: The security=share option is deprecated

Enter root's password:     #在这儿不需要输入密码,因为我们的security=share

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.9-169.el6_5]

Server not using user level security and no password supplied.

smb: \> ls

  .                                   D        0  Tue Sep  9 15:00:52 2014

  ..                                 DR        0  Tue Sep  9 16:33:36 2014

  nutch2                              D        0  Fri Feb 21 15:21:10 2014

  share                               D        0  Tue Sep  9 15:08:23 2014

  hadoop                              D        0  Fri Jan 17 17:40:29 2014

 

              35418 blocks of size 524288. 19689 blocks available

smb: \>

win7中访问

\\192.168.232.140\share

Samba安装详细步骤_第1张图片

Samba安装详细步骤_第2张图片

7、设置samba开机自启动

/etc/init.d/rc 这个文件中加入

#start smba

/etc/init.d/smb restart

8、在windows中无法访问Linux共享的文件,常见原因如下:

A、防火墙未关闭

:似乎普通用户没办法查看防火墙状态

[root@master1 ~]# /etc/init.d/iptables status

#防火墙未开启

表格:filter

Chain INPUT (policy ACCEPT)

num  target     prot opt source               destination        

 

Chain FORWARD (policy ACCEPT)

num  target     prot opt source               destination        

 

Chain OUTPUT (policy ACCEPT)

num  target     prot opt source               destination    

暂时关闭防火墙,重启失效

[root@master1 ~]# service iptables stop

重启后永久生效

chkconfig iptables on/off

BSELinux未关闭

[root@nutch 桌面]# vi /etc/selinux/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=enforcing

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

重启服务

[root@nutch 桌面]# /etc/rc.d/init.d/smb restart

或者重启计算机

reboot

C、文件本身的权限设置 -rwx-rwx-rwx

[root@nutch 桌面]# chmod 766 /home/test/a.txt


你可能感兴趣的:(Samba安装详细步骤)