Samba-installation-under-centos

Install samba server

Preparation

disable selinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

stop iptables

/etc/init.d/iptables stop [start,status,restart]

check if old samba package exist

[root@localtest home]# rpm -qa|grep samba
samba-winbind-3.6.23-14.el6_6.x86_64
samba-common-3.6.23-14.el6_6.x86_64
samba4-libs-4.0.0-66.el6_6.rc4.x86_64
samba-client-3.6.23-14.el6_6.x86_64
samba-winbind-clients-3.6.23-14.el6_6.x86_64

# if exist, you can delete
# rpm -e samba-common-3.6.23-14.el6_6.x86_64
# or not to delete and wait yum related update

Installation via yum

installation

yum install -y samba samba-client samba-swat
=========================================================================================================================
Package                     Arch                    Version                              Repository                Size
=========================================================================================================================
Installing:
samba                       x86_64                  3.6.23-14.el6_6                      updates                  5.0 M
samba-swat                  x86_64                  3.6.23-14.el6_6                      updates                  7.3 M
Installing for dependencies:
xinetd                      x86_64                  2:2.3.14-39.el6_4                    base                     121 k

Transaction Summary
=========================================================================================================================
Install       3 Package(s)

check installation

[root@localtest home]# rpm -qa|grep samba
samba-winbind-3.6.23-14.el6_6.x86_64
samba-swat-3.6.23-14.el6_6.x86_64
samba-common-3.6.23-14.el6_6.x86_64
samba-3.6.23-14.el6_6.x86_64
samba4-libs-4.0.0-66.el6_6.rc4.x86_64
samba-client-3.6.23-14.el6_6.x86_64
samba-winbind-clients-3.6.23-14.el6_6.x86_64

start/stop/restart samba service

[root@localtest home]# /etc/init.d/smb status
smbd is stopped
[root@localtest home]# /etc/init.d/smb start
Starting SMB services:                                     [  OK  ]
[root@localtest home]# /etc/init.d/smb status
smbd (pid  24455) is running...

add to auto-start after reboot

chkconfig --level 35 smb on

Configuration

config file

/etc/samba/smb.conf
## two part
>> Global Setting   [global]
>> Share Definitions    [share-name]

global setting

[global]
config file = /usr/local/samba/lib/smb.conf.%m
workgroup = WORKGROUP
server string = Samba Server Version %v
## netbios name and workgroup have different name
netbios name = smbserver
interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
hosts allow = 127. 192.168.1. 192.168.10.1
## hosts allow = 172.17.2. EXCEPT172.17.2.50
hosts deny =
...

share definitions

[share-name]
path = share-path
browerable = yes/no
writable = yes/no
available = yes/no
# samba 3.0 ,if security = share ,the item is invalid
admin users = admin1[, admin2, ...]
valid users = common-users[, user2, @group1, @group2, ...]
write list = user-list-with-write-role
public = yes/no   ## if let guest accout visit
guest ok = yes/no  ## means 'public'

some special share definitions

[homes]
comment = Home Directories
browerable = no
writable = yes
path = your-samba-path
valid users = %S
; valid users = MYDOMAIN\%S


[netlogon]
comment = All Printers
path = /var/spool/samba
browerable = no
guest ok = yes
writable = no
printable - yes

[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
guest ok = yes
writable = no
share modes = no

[Profiles]
path = /var/lib/samba/profiles
browerable = no
guest ok = yes
    原文作者:全栈运维
    原文地址: https://www.jianshu.com/p/31db08882ba2
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞