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:
On a fresh installation of Centos 6.2 you need to follow the following steps:
- Install semanage with yum
yum -y install policycoreutils-python
- Configure the samba configuration file: /etc/samba/smb.conf
[global]
workgroup = yourworkgroupname
server string = yourservername
security = user
passdb backend = tdbsam - Configure your share in the same file
[share]
path = /your/share/path
writable = yes
guest ok = yes - Set your samba password for your user by logging in with that user on the target machine and execute the following command:
smbpasswd
- Open the Samba ports on your firewall
[139/tcp,445/tcp,137/udp,138/udp]
- Now it's time for configuring SELinux. Enable the domain controller by executing the following command:
setsebool -P samba_domain_controller on
- If you want home directories to be shared also execute the following directory:
setsebool -P samba_enable_home_dirs on
- 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(/.*)?'
- And than you need to also execute the following command
restorecon -R /shared/path
- Now the only thing you have to do is start the following samba services:
- nmb
- smb
Comments
Post a Comment