① Machine Windowxp② Machine centos6.4
I. Pre-installation Preparation
1. Using the Samba server requires a firewall to open the following ports
UDP 137
UDP 138
TCP 139
TCP 445
Vi/etc/sysconfig/iptables #配置防火墙端口
-A input-m state--state new-m tcp-p TCP--dport 139-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 445-j ACCEPT
-A input-m state--state new-m udp-p UDP--dport 137-j ACCEPT
-A input-m state--state new-m udp-p UDP--dport 138-j ACCEPT
/etc/rc.d/init.d/iptables restart #重启防火墙 to make the rules effective
Two. Turn off SELinux
Vi/etc/selinux/config
#SELINUX =enforcing #注释掉
#SELINUXTYPE =targeted #注释掉
Selinux=disabled #增加
: Wq save, close.
Shutdown-r now restarts the system.
If you do not want to restart your computer
Modify the SELinux real-time operation mode (only temporary changes, if completely closed using the above method)
Setenforce 1 setting SELinux to be enforcing mode (mandatory mode)
Setenforce 0 setting SELinux into permissive mode (loose mode)
Three. Installing Samba services
The first step; 1. Check that the Samba Service pack is installed
Rpm-qa | grep samba
samba-winbind-3.6.9-168.el6_5.i686
samba-winbind-clients-3.6.9-168.el6_5.i686
samba-client-3.6.9-168.el6_5.i686//client software, The tool instruction set required to provide the main Linux host as a client is
samba-common-3.6.9-168.el6_5.i686 //Main provision Samba server settings file and settings file Syntax verifier testparm
samba-3.6.9-168.el6_5.i686//server-side software, mainly provides the Samba server daemon, Shared documents, rotation of logs, boot default option
samba4-libs-4.0.0-61.el6_5.rc4.i686
Description Samba is already installed, if not installed, run the following command to install
Yum Install Samba
Second, configure Samba
Chkconfig SMB on #设置 Samba boot up automatically
Service SMB Start #启动Samba服务
Chkconfig NMB on #设置Samba别名服务自动启动
Service NMB Start #启动Samba别名服务
/ETC/INIT.D/SMB Restart #重启
/ETC/INIT.D/SMB Stop #停止
/ETC/INIT.D/NMB Restart #重启
/ETC/INIT.D/NMB Stop #停止
Backup: Cp/etc/samba/smb.conf/etc/samba/smb.confbak
Recovery: cp/etc/samba/smb.confbak/etc/samba/smb.conf
Vi/etc/samba/smb.conf
[Global] #找到这一行 (Globally set tab), add the following line below this line:
Workgroup = Workgroup #工作组名称改为 the workgroup name defined by the Windows network
Server string = Samba Server #设置samba服务器的主机名称
Security = User #设置samba服务器安全级别为user, which is accessed by account and password
NetBIOS name = Sambaserver #设置Samba服务器访问别名
#在配置文件的末尾添加以下自定义内容
[Sambaserver] #在Windows网上邻居中看到的共享目录的名字
Comment = Sambaserver #在Windows网上邻居中看到的共享目录的备注信息
Path =/home/sambaserver #共享目录在系统中的位置
public = no #不公开目录
writable = yes #共享目录可以读写
Valid Users=sambaserver #只允许SambaServer用户访问
Save Configuration
3. Add an account to access the Linux shared directory Sambaserver
User home directory is/home/sambaserver, user login terminal is set to/bin/false (even if it cannot log on to the system)
Cd/home #进入/home Directory
mkdir Sambaserver #建立SambaServer文件夹
Touch samba.txt #创建测试文件samba. txt
Useradd sambaserver-d/home/sambaserver-s/bin/false
Chown Sambaserver:sambaserver/home/sambaserver-r
System operation and maintenance www.osyunwei.com warm reminder: qihang01 original content copyright, reproduced please indicate the source and the original link
4. Add the user sambaserver to the Samba user database and set the password for the login shared directory to: 123456
Smbpasswd-a Sambaserver
New SMB Password: Enter the password that the user uses to log in to Samba
Retype new SMB Password: Confirm entering this password again
Added user Sambaserver.
#特别注意: The password set here is the user's password to log in to the Samba shared directory, not the user's password to log on to the Linux system
5. Restart the Samba server
/ETC/INIT.D/SMB restart
6. In Windows Client input
\\ip
Or
\\SambaServer #服务器别名
After enter, will jump out the login box, enter the account sambaserver password 123456
To access the shared directory
At this point, the CentOS 6.4 Linux Samba server configuration is complete.
Iii. accessing Samba in Windows and Linux
1, Windows direct win key r:\\IP
2, Linux with command:
A, smbclient//IP address/samba share filename-u user name% password, login may command operation. If you don't understand, you can use Help.
B, Mount-t cifs//192.168.1.101/sambaserver/samba/
Iv. FAQ
1. No access to Samba services?
A: Make sure that the SMB service starts. B. Turn off SELinux
2. Cannot access Windows file mount failure
A; Set Windows folder permissions to add read and write permissions to the Everyone account
Basically complete more detailed and powerful network management features about Samba services down in the wash-and-sleep went ~~~~~~~~~
[email protected]
2014-6-24 0:52