Samba Server Configuration
CentOS 6.5_x64
========================
1 Guaranteed Network connectivity
[Email protected] ~]# ifconfig eth0
Eth0 Link encap:ethernet HWaddr 00:0c:29:56:17:70
inet addr:192.168.1.166 bcast:192.168.1.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE56:1770/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:132 errors:0 dropped:0 overruns:0 frame:0
TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13048 (12.7 KiB) TX bytes:10173 (9.9 KiB)
Interrupt:18 Base address:0x2000
[[Email protected] ~]# service iptables stop
Iptables: Set the chain to policy accept:filter [OK]
Iptables: Clear Firewall rule: [OK]
Iptables: Uninstalling module: [OK]
[Email protected] ~]# chkconfig iptables off
[Email protected] ~]# Setenforce 0
----------------------------------------
2 Installing the Samba Server package group (local Yum source mode installation)
2.1 Mounting Discs
[Email protected] ~]# mount/dev/cdrom/media/
Mount:block Device/dev/sr0 is write-protected, mounting read-only
[Email protected] ~]# cd/etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir AAA
[Email protected] yum.repos.d]# MV *.repo aaa/
[email protected] yum.repos.d]# CP Aaa/centos-media.repo.
[[email protected] yum.repos.d]# ls
AAA Centos-media.repo
[Email protected] yum.repos.d]# VI Centos-media.repo
... The above contents are omitted.
[C6-media]
name=centos-$releasever-media
baseurl=file:///media///Modify here to indicate the path of the Yum repository file
Gpgcheck=1//Indicates enable GPG checksum validation
Enabled=1//Change the 0 here to 1, indicating that local Yum source installation is enabled
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
------------------------------------------------------
2.2 Installing with the Yum command
[[email protected] ~]# yum-y Install samba//Installing Samba
====
3: Build a shared that can be accessed anonymously
3.1 Modifying a configuration file
[Email protected] ~]# cd/etc/samba/
[email protected] samba]# CP smb.conf Smb.conf.bak
[Email protected] samba]# VI smb.conf
.. Omitted above:
101 Security = Share//change user to share, enable anonymous sharing
.. Omitted above
289 [Guangpan]
290 comment = Cdromcdrom
291 Path =/media
292 Public = yes
293 Read Only = yes
294 [Benet]
295 comment = Share files
296 Path =/aaa
297 Public = yes
298 writable = yes
====================================
[Email protected] samba]# MKDIR/AAA
[Email protected] samba]# chmod 777/aaa
3.2 Correctness of the test configuration file
[Email protected] samba]# Testparm
Load SMB config files from/etc/samba/smb.conf
Rlimit_max:increasing Rlimit_max (1024x768) to minimum Windows limit (16384)
Processing section "[Homes]"
Processing section "[Printers]"
Processing section "[Guangpan]"
Processing section "[Benet]"
Warning:the security=share option is deprecated
Loaded Services file OK. This row indicates that there is no error in the configuration file
.. The following is omitted:
---------------------------------------------
3.3 Starting the Samba server
[[Email protected] samba]# service SMB restart
Turn off the SMB service: [OK]
Start the SMB service: [OK]
[[email protected] samba]# chkconfig SMB on
[Email protected] samba]# chkconfig SMB--list
SMB 0: Shutdown 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off
----------------------------------------------------
3.4 Detection
==================
4: Build a share that requires user authentication
4.1 Creating a Samba User database file
[Email protected] aaa]# Useradd Vina
[Email protected] aaa]# pdbedit-a-u vina
New Password:
Retype new Password:
Unix Username:vina
===================
[Email protected] aaa]# pdbedit-l
VINA:500:
[Email protected] aaa]# PDBEDIT-VL Vina
Unix Username:vina
NT Username:
Account Flags: [U]
User sid:s-1-5-21-2552859447-2060033353-296718525-1000
Primary Group sid:s-1-5-21-2552859447-2060033353-296718525-513
Full Name:
Home Directory: \\localhost\vina
Homedir Drive:
Logon Script:
Profile Path: \\localhost\vina\profile
Domain:localhost
Account desc:
Workstations:
Munged Dial:
Logon time:0
Logoff time: Three, 06 February 2036 23:06:39 CST
Kickoff time: Three, 06 February 2036 23:06:39 CST
Password last set: Four, 09 July 10:21:00 CST
Password can change: four, 09 July 10:21:00 CST
Password must Change:never
Last Bad password:0
Bad password count:0
Logon HOURS:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
============================================
4.2 Setting up user access authorizations
4.2.1 New test catalog and test user
[Email protected] aaa]# Useradd Tom
[Email protected] aaa]# Useradd Lisi
[Email protected] aaa]# pdbedit-a-U Tom
[Email protected] aaa]# pdbedit-a-u Lisi
[Email protected] aaa]# MKDIR/XING/AAA
[Email protected] aaa]# chmod 777/xing/aaa
4.2.2 Modify the smb.conf configuration file to add a shared directory named AAA
[Email protected] aaa]# vi/etc/samba/smb.conf
Above omitted ...
101 Security = User//change here to user, which means enable user security level
Append the following to the last line
299 [Tools]
Comment = can get software tools from here.
301 Path =/xing/aaa
302 public = No
303 Read Only = yes
304 Valid users = Tom, Lisi
305 Write List = Lisi
306 Directory mask = 0755
307 Create mask = 0644
4.2.3 Reload smb.conf File
[[Email protected] aaa]# service SMB Reload
Reload the smb.conf file: [OK]
This article is from "Ah xing" blog, please be sure to keep this source http://xing5186.blog.51cto.com/2947464/1672961
Samba Server Configuration