vsftpd nfs autofs samba firewalld selinux lvm 的试验过程
yum -y install vsftpd
echo 'anon_root=/' >> /etc/vsftpd/vsftpd.conf
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
systemctl restart vsftpd
curl ftp://192.168.10.110
wget -r ftp://192.168.10.110
yum -y install nfs*
mkdir -p /opt/nfs
echo '192.168.10.0/24(rw,sync)' >> /etc/exports
chmod 777 /opt/nfs
systemctl restart rpcbind
systemctl restart nfs
firewalld-cmd --permanent --add-service=nfs
firewall-cmd --reload showmount不属于nfs服务建议关闭防火墙showmount
(setenforce 0) 可有可无
showmount -e 192.168.10.110
mount -t nfs 192.168.10.110:/opt/nfs /mnt
touch flag
搭建一个可以访问的nfs
yum -y install autofs
mkdir /share
vim /etc/auto.master.d/test.autofs
/share /etc/auto.test
:x
进share的时候跳转到auto.test auto.test访问nfs
vim /etc/auto.test
pub 192.168.10.110:/opt/nfs
:x
systemctl restart autofs
cd /share/pub
(网卡 yum配置好)
systemctl stop firewalld
setenforce 0
yum -y install samba
cat >> /etc/samba/smb.conf << q
[supermao]
comment = share dir
path = /home/samba
public = yes
writable = yes
browseable = yes
q
mkdir /share
chmod 777 /share
useradd 1
smbpasswd -a 1
密码
pdbedit -L (查看smb用户)
systemctl restart smb
systemctl enable smb
(setenforce 1 systemctl start firewalld) yum -y install samba* mkdir -p /opt/samba cd /opt/samba touch flag chmod -R o+w samba/ 首先查看 vi /etc/samba/smb.conf.example 然后开启对应的selinux功能 setsebool -P samba_domain_controller on ### 开启域名访问功能 setsebool -P samba_enable_home_dirs on ### 开启用户目录功能 chcon -t samba_share_t /opt/samba/ ### 给目录samba se标签 setsebool -P samba_export_all_rw on ### 开启端口读写 cat >> /etc/samba/smb.conf << q [supermao] comment = mao directories path = /opt/samba interfaces = 192.168.100.10/24 #开在这个ip地址的网卡上 hosts allow = 192.168.200. #允许这个网段的用户访问 browseable = yes valid users = mao,tom,alias #有效用户 write list = mao #写权限 查看配置文件是否正确 testparm useradd mao useradd tom useradd alias smbpasswd -a mao #创建samba用户 smbpasswd -a tom smbpasswd -a alias pdbedit -L systemctl restart smb systemctl restart nmb firewall-cmd --add-service=samba --permanent firewall-cmd --reload
1.windows作client
win+r \ip
cmd net use * /del 清除上次的登录用户(等待一会儿)
2.Linux作client
yum -y install samba-client
smbclient -U jeccy //192.168.100/commom
设置防火墙端口转发
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=192.168.200.0/24 forward-port port=5423 protocal=tcp to-port=80'
设置添加端口
firewall-cmd --permanent --add-port=80/tcp
设置添加服务
firewall-cmd --permanent --add-service=http
(另一种设置端口转发的方式,查看帮助文档)
firewall-cmd --help | grep forward
seliunx是linux操作系统的一个额外的强制性的安全访问规则。用于确定哪个进程可以访问哪些文件、目录和端口的一组安全规则。保护的对象是服务+
修改selinux上下文 (重启selinux后失效)
chcon -t samba_share_t /opt/samba/
永久修改selinux上下文
semanage fcontext -a -t httpd_sys_content_t '/www(/.*)?'
restorecon -RFv /www
查看端口上下文
semanage port -l | grep http
添加端口上下文
semanage port -a -t http_port_t -p tcp 8088
semanage port -a -t http_port_t -p tcp 8089
添加硬盘
并使用fdisk给硬盘分区
fdisk /dev/sdb
pvcreate /dev/sdb
vgcreate vgsup /dev/sdb
lvcreate -L 3G -n lv0 vgsup
mkfs.xfs /dev/mapper/vgsup-lv0
(ext4) resize2fs /dev/mapper/myvg-mylv
vgextend vgsup /dev/sdc
lvextend -L 25G /dev/vgsup/lv0
xfs_growfs /dev/mapper/vgsup-lv0
lvs vgs pvs
lvdisplay vgdisplay pvdisplay