Introduction
Samba allows us to access files in a Linux system in Windows, which is very handy if you are debugging code in a Linux virtual machine.
1. Installation
Yum-y Updateyum Install Samba samba-client samba-swat-y
2. Check the installation situation
[Email protected] samba]# Rpm-qa|grep Samba Samba-swat-3.6.23-20.el6.i686samba-common-3.6.23-20.el6.i686samba-winbind-clients-3.6.23-20.el6.i686samba-3.6.23-20.el6.i 686samba-winbind-3.6.23-20.el6.i686samba-client-3.6.23-20.el6.i686
3. Do the following on the routing table:
Iptables-i input 4-m State--state new-m udp-p UDP--dport 137-j ACCEPT iptables-i INPUT 5-m State--state NEW -M udp-p UDP--dport 138-j accept iptables-i INPUT 6-m State--state new-m tcp-p TCP--dport 139-j accept S Ervice iptables Save
4. Create user
Useradd smbuser groupadd smbgrp usermod-a-G smbgrp smbuser smbpasswd-a smbuser
5. Generate Directory
cd/home/samba/ mkdir test chown-r smbuser:smbgrp test/
6. Generate Configuration file
[Global]workgroup = Mygroupserver string = Samba Server Version%vlog file =/var/log/samba/log.%mmax log size = 50securit y = sharepassdb backend = tdbsamload printers = yescups options = raw[homes] comment = Home directoriesbrowseable = no writable = yes [printers] comment = All Printerspath =/var/spool/sambabrowseable = no guest OK = no writable = no printable = yes [Share]path =/tmpwriteable = Yesbrowseable = Yescreate mask = 0664directory mask = 0775gues T ok = yespublic = Yes[test] comment = Public Stuffpath =/home/samba/public = yes writable = yes printable = No write list = +staff Valid users = SMB
7. Restart
Chkconfig SMB on chkconfig NMB on service SMB restart && service NMB restart
If you are having problems with permissions, please reconfirm the following points
1. Turn off the firewall: service iptables stop2. Set the SELinux relaxed mode: Setenforce 03. Set the properties of the folder you need to share to 777,chmod 777/share4. The SMB and NMB services are restarted.
Recently when configuring Samba,windows connection, the following problem occurred:Samba does not allow a user to use more than one user name for multiple connections to a server or shared resource
NET use */del/y
This is not a samba restriction, it is a limitation of Windows, if you want to use Public=yes, the above method can not effectively solve
cause : When you open a Samba server that exists Public=yes, if you first click on a shared resource with public=yes, widows will use the default username to connect to the server, generally is the Windows login name (can be seen on the server side), this time, then to click on a shared resource without public=yes, because the user level, the server will require authentication, then, the previous default login already exists, there is a landlord fault. Even if you do not access the shared resource in the correct order after you log out of the connection, you are stuck in this quagmire. Therefore, the best way is not to Public=yes, to create a common account for public accounts and publicity. This way, in fact, the authority is more clear
Reference:
http://www.linuxsir.org/main/?q=node/158
Http://blogold.chinaunix.net/u/19637/showart_491257.html
CentOS Installation Configuration Samba