Setup Samba server on Centos 6.2

After a long struggle I finally figured out how to setup a Samba server on Centos 6.2. Since Centos 6.2 doesn't have the Samba configuration GUI anymore I didn't know how to set it up. But after a lot of trial and error and my friend Google I manages to get it up and running without disabling SELinux :-).

On a fresh installation of Centos 6.2 you need to follow the following steps:

  1. Install semanage with yum
    yum -y install policycoreutils-python
  2. Configure the samba configuration file: /etc/samba/smb.conf
    [global]
    workgroup = yourworkgroupname
    server string = yourservername
    security = user
    passdb backend = tdbsam
  3. Configure your share in the same file
    [share]
    path = /your/share/path
    writable = yes
    guest ok = yes
  4. Set your samba password for your user by logging in with that user on the target machine and execute the following command:
    smbpasswd
  5. Open the Samba ports on your firewall [139/tcp,445/tcp,137/udp,138/udp]
  6. Now it's time for configuring SELinux. Enable the domain controller by executing the following command:
    setsebool -P samba_domain_controller on
  7. If you want home directories to be shared also execute the following directory:
    setsebool -P samba_enable_home_dirs on
  8. Now you need to use some semanage magic to complete the configuration by executing the following command:
    semanage fcontext -a -t samba_share_t '/shared/path(/.*)?'
  9. And than you need to also execute the following command
    restorecon -R /shared/path
  10. Now the only thing you have to do is start the following samba services:
    - nmb
    - smb

Comments

Popular posts from this blog

Tomcat behind Apache HTTP server using Spring Security

Fastest XML parser

Configure Tomcat as a deamon on Linux