- Install samba
[nick1811@centos-6 ~]$ sudo yum install -y samba
[nick1811@centos-6 ~]$ sudo vim /etc/selinux/config
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled
[nick1811@CentOS-6 ~]$ sudo pdbedit -a -u nick1811 new password: retype new password:
[nick1811@CentOS-6 ~]$ sudo printf "********\n********\n" | sudo pdbedit -t -a -u nick1811 Unix username: nick1811
[nick1811@centos-6 ~]$ sudo pdbedit -x -u nick1811
[nick1811@CentOS-6 ~]$ sudo pdbedit -L nick1811:500:nick1811
[nick1811@centos-6 ~]$ sudo chkconfig smb on
- create samba shares folder
[nick1811@CentOS-6 ~]$ sudo mkdir -p /usr/local/samba/lib/usershares [nick1811@CentOS-6 ~]$ sudo chown root:nick1811 /usr/local/samba/lib/usershares [nick1811@CentOS-6 ~]$ sudo chmod 1770 /usr/local/samba/lib/usershares [nick1811@CentOS-6 ~]$ sudo chcon -R -t samba_share_t /usr/local/samba/lib/usershares
[nick1811@CentOS-6 ~]$ sudo vim /etc/samba/smb.conf
#======================= Global Settings ===================================== [global] wins support = yes usershare path = /usr/local/samba/lib/usershares usershare max shares = 100 usershare allow guests = true usershare owner only = false # Samba works on NFS-Shares admin users = nick1811 strict locking = no oplocks = no acl check permissions = false
- To share samba folder
[nick1811@centos-6 ~]$ net usershare add nick_samba /home/nick1811/samba/ "nick's samba folder" Everyone:F guest_ok=y
[nick1811@centos-6 ~]$ net usershare delete nick_samba
[nick1811@centos-6 ~]$ sudo service smb start
[nick1811@centos-6 ~]$ sudo service smb stop
[nick1811@centos-6 ~]$ sudo service smb restart
[nick1811@CentOS-6 ~]$ sudo vim /etc/sysconfig/iptables
# SAMBA/CIFS -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
[nick1811@CentOS-6 ~]$ sudo service iptables restart iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: [ OK ]
References:
No comments:
Post a Comment