修改配置文件/etc/sysconfig/network-scripts/ifcfg-eth0(eth0,第一塊網卡,如果是第二塊則爲eth1),保證主機虛擬機互相ping通
2.安裝samba
yum -y install samba samba-client samba-common
命令rpm -qa | grep samba 查看已經安裝的samba相關軟件
3.創建用戶
添加用戶
useradd xxx (userdel刪除用戶 usermod修改用戶組 id xxx查看用戶組情況 )
添加samba密碼
smbpasswd -a xxx
4.創建共享文件夾
mkdir -p /xxx
修改文件夾權限
chgrp xxx /xxx
chown xxx /xxx
chmod 770 /xxx
(ls /xxx -l 查看文件夾權限)
5.修改samba配置文件
備份原配置文件
mv smb.conf smb.conf.bak
修改配置文件
vi smb.conf
清空並修改smb.conf內容
[global]
workgroup = WORKGROUP
netbios name = xxx
server string = Samba Server
security = user
map to guest = Bad Uesr
[xxx]
path = /xxx
writable = yes
browseable = yes
guest ok = yes
write list = @xxx
validusers = @xxx
6.重啓samba服務
systemctl restart smb
systemctl reload smb
systemctl status smb
7.關閉防火牆和SELinux
關閉防火牆
systemctl stop fitewalld
systemctl disable firewalld
關閉SELinux666666666666666666
vi /etc/selinux/config 修改 SELINUX=disabled
8.設置開機啓動samba
chkconfig smb on
9 /etc/passwd的權限應該爲644。
Centos7 關閉防火牆
CentOS 7.0默認使用的是firewall作爲防火牆,使用iptables必須重新設置一下
1、直接關閉防火牆
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
2、設置 iptables service
yum -y install iptables-services
如果要修改防火牆配置,如增加防火牆端口3306
vi /etc/sysconfig/iptables
增加規則
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
保存退出後
systemctl restart iptables.service #重啓防火牆使配置生效
systemctl enable iptables.service #設置防火牆開機啓動
最後重啓系統使設置生效即可。
Centos7 Firewalld 解決防火牆問題
**
第一次使用Firewalld關了半天沒關掉,之前一直使用iptables,從來沒出現過這麼撓頭的問題。
記錄一下我解決端口不能訪問的問題,其實思路很簡單,卸載Firewalld安裝iptables
一步一步來說吧
1. Disable Firewalld Service.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl mask firewalld
2. Stop Firewalld Service.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl stop firewalld
3. Install iptables service related packages.
[root@rhel-centos7-tejas-barot-linux ~]# yum -y install iptables-services
4. Make sure service starts at boot:
[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable iptables
[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable ip6tables
5. Now, Finally Let’s start the iptables services.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl start iptables
[root@rhel-centos7-tejas-barot-linux ~]# systemctl start ip6tables
安裝iptables 已經完成了這個時候iptables已經能用了。
但是您的Firewalld 還在runing。不信您可以查看一下
firewall-cmd –state
好了不廢話了,直接yum remove firewalld
終於卸載了………………………..
好了你可以使用iptables了,盡情使用吧。
如果您連iptables也不想用了那就使用
service iptables stop命令關閉吧。