Why?


Search This Blog

Thursday, April 2, 2015

Samba Setup on Centos 6.6

Samba Setup on Centos 6.6

Since I am behind a firewall in my local LAN I have disabled SELINUX and turned firewall off. i am also fully up to date on packages as of 4/1/2015.

Disable SELinux

# vi /etc/selinux/config
And change to SELINUX=disabled

Turn off firewall

# service iptables stop
# chkconfig iptables off
# reboot

NOTE** I fought with this for day so beware! I am on Centos 6.6 I have the epel repo active in my repo list. When I used yum for the install of samaba, I think it got it from there. All worked well with using \\ip_addr_of_samba_server\ but I could never get my samba server to show up in windows network browser. I discovered nmb was NOT running on the samba server. Not good if you want windows to discover it automatically. So I completely removed samba using “yum –y remove samba*” (notice the * at the end of samba. And leave out the quotes). I then removed the epel repo with “rpm -e your-epel-package-name-here” Now you can install samba with the steps below and have it work 100%.

Install samba

# yum -y install samba

Create user and set password for samba share use

# useradd samba -s /sbin/nologin
# smbpasswd -a samba
            Supply a password
            Retype the password

mkdir for the shared files and set permissions

# mkdir /share
# chown -R samba:root /share/

Now config samba for the share and share user

# vi /etc/samba/smb.conf

Add/edit this under the [global] section

[global]
workgroup = WORKGROUP ;use name of your workgroup here
server string = Samba Server Version %v
netbios name = SAMBA

Add this to botton of /etc/samba/smb.conf file

[share]
comment = Share
path = /share
writable = yes
valid users = shareuser

Now start samaba and make sure it is on after boot

# service smb start
# chkconfig smb on
# service nmb start
# chkconfig nmb on

Now test your setup with

# testparm

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[share]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
cups options = raw
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No
[share]
comment = Share
path = /share
valid users = shareuser
read only = No


NOTE** make sure your workgroup =  is the actual name of your Windows workgroup, smb service is running, and nmb service is running, or you won’t see your samba server when windows machines browse the network.

Note: ** when accessing your samba server from windows 8.1 there is a problem with accessing the same server with two sets of credentials. Meaning if you login to a samba share as one user you will not be able to login to another share as another user. If you need to change users you can relogin into Windows OS (not cool) or use:

C:\> net use * /DELETE

Say yes to remove the connection(s) you already have, thus saving a reboot :) 

If you get CUPS printer messages in your /var/log/messages file you can edit the smb.conf file to reflect the following:

        load printers = yes
        cups options = raw

;       printcap name = /etc/printcap
        # obtain a list of printers automatically on UNIX System V systems:
        printcap name = /dev/null
        printing = bsd



Thanks to:

http://www.if-not-true-then-false.com/2010/yum-remove-repo-repository-yum-disable-repo-repository/

http://www.krizna.com/centos/installing-configuring-samba-centos-6/

The end!

No comments:

Post a Comment