1.准备俩台虚拟机(配置好网络,关掉防火墙,selinux)
vsftpd:
ftp节点配置Yum
mv /etc/yum.repos.d/* /media/
vim /etc/yum.repos.d/lcoal.repo
[centos] name=centos baseurl=file:///mnt gpgcheck=0 enabled=1
mount -o loop /dev/sr0 /mnt
yum repolist
安装vsftpd
yum install -y vsftpd
systemctl start vsftpd(启动服务)
虚拟用户配置:
vim /etc/vsftpd/users.conf
lw 1234 lw1 5678
lw2
91011
db_load -T -t hash -f /etc/vsftpd/users.conf /etc/vsftpd/users.db
chmod 600 /etc/vsftpd/users.*
创建 FTP 根目录及虚拟用户映射的系统用户useradd vsftpd -d /home/vsftpd -s /sbin/nologin
mkdir -p /home/vsftpd/xmcsxy
chmod -R 777 /home/vsftpd
验证文件
vim /etc/pam.d/vsftpd
#%PAM-1.0 auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/users account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/users session optional pam_keyinit.so force revoke auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed auth required pam_shells.so auth include password-auth account include password-auth session required pam_loginuid.so session include password-auth
添加虚拟用户支持:
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO(改为NO禁止匿名登录) 添加如下配置 chroot_local_user=YES guest_enable=YES allow_writeable_chroot=YES user_config_dir=/etc/vsftpd/vsftpd_user_conf
为虚拟用户建立配置文件:
mkdir -p /etc/vsftpd/vsftpd_user_conf
cd !$
vim lw
local_root=/home/vsftpd/xmcsxy/lw anon_upload_enable=NO
write_enable=YES
anon_max_rate=60000
vim lw1
local_root=/home/vsftpd/xmcsxy/lw1 write_enable=YES anon_upload_enable=NO anon_max_rate=60000
vim lw2
local_root=/home/vsftpd/xmcsxy/lw2 write_enable=YES anon_upload_enable=NO anon_max_rate=60000
创建工作目录:
mkdir -p /home/vsftpd/xmcsxy/lw
mkdir -p /home/vsftpd/xmcsxy/lw1
mkdir -p /home/vsftpd/xmcsxy/lw2
重启服务:
systemctl restart vsftpd
systemctl enable vsftpd
nfs部署:
配置本地yum与ftp一样
yum install -y nfs-utils rpcbind
systemctl start rpcbind(启动rpc服务)
systemctl enable rpcbind(开机自启)
systemctl start nfs(启动nfs服务)
systemctl enable nfs(开机自启)
创建存放数据目录
mkdir /data
chown -R nfsnobody:nfsnobody /data/
chmod 755 -R /data
添加磁盘 分区挂载
fdisk /dev/sdb
vim /etc/fstab
mount -a
配置共享目录
vim /etc/exports
exportfs -rv
showmount -e 192.168.100.11
ftp节点配置
yum install -y nfs-utils rpcbind
mount -t nfs 192.168.100.12:/data
cd /home/vsftpd/xmcsxy
mkdir liwei1 liwei2 liwei3