In order to install samba, just issue the following command:
yum install samba -yYou will need to open the firewall for ports 139 & 445 (don't forget to save it):
iptables -I INPUT -p tcp --dport 139 -j ACCEPTMake sure that samba starts with the system:
iptables -I INPUT -p tcp --dport 445 -j ACCEPT
chkconfig smb onThere are a few SELinux settings related to samba(default settings):
chkconfig nmb on
samba_create_home_dirs --> offNote, that there is a bit off information regarding SELinux contexts on the samba config file.
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_run_unconfined --> off
samba_share_fusefs --> off
samba_share_nfs --> off
use_samba_home_dirs --> off
virt_use_samba --> off
You can now start samba with:
service smb start; service nmb startLet's get back to the objective, say you want to create a share called myshare to all clients in your network, you'll need to edit /etc/samba/smb.con like this:
[myshare]This share will be available to all hosts in 192.168.1.0, except for 33 and also to 10.168.1.65.
comment=A share for me
path = /myshareddirectory
browseable = yes
writable = no
valid users=myuser
hosts allow = 192.168.1. 10.168.1.65
hosts deny = 192.168.1.33
You'll need to set the following SELinux setting to allow to list the files:
setsebool -P samba_export_all_ro 1and if you want to set the share as writable, you'll also need this:
setsebool -P samba_export_all_rw 1Remember to change the security context type of your shared directory, in my case:
chcon -t samba_share_t /myshareddirectoryYou need to add the samba user myuser:
smbpasswd -a myuserYou can now,assuming that your server is 192.168.1.64, finally, mount the share with (you might need to install cifs-utils):
mount.cifs //192.168.1.64/myshare /test -o user=myuser
No comments:
Post a Comment