1、建立samba共享,共享目录为/data,要求:(描述完整的过程)
1)共享名为shared,工作组为magedu;
2)添加组develop,添加用户gentoo,centos和ubuntu,其中gentoo和centos以develop为附加组,ubuntu不属于develop组;密码均为用户名;
3)添加samba用户gentoo,centos和ubuntu,密码均为“mageedu”;
4)此samba共享shared仅允许develop组具有写权限,其他用户只能以只读方式访问;
5)此samba共享服务仅允许来自于172.16.0.0/16网络的主机访问;
vim /etc/samba/smb.conf 全局配置 workgroup=magedu hosts allow=172.16.0.0/16 [shared] path=/data read only=yes write list=@develop browseable=yes groupadd develop useradd gentoo useradd centos useradd ubuntu echo gentoo | passwd --stdin gentoo echo centos | passwd --stdin centos echo ubuntu | passwd --stdin ubuntu usermod -aG develop gentoo usermod -aG develop centos smbpasswd -a centos #添加samba用户并设置密码 smbpasswd -a gentoo smbpasswd -a ubuntu setfacl -m g:develop:rwx /data/ testparm systemctl start smb.service
2、搭建一套文件vsftp文件共享服务,共享目录为/ftproot,要求:(描述完整的过程)
1)基于虚拟用户的访问形式;
2)匿名用户只允许下载,不允许上传;
3)禁锢所有的用户于其家目录当中;
4)限制最大并发连接数为200:;
5)匿名用户的最大传输速率512KB/s
6)虚拟用户的账号存储在mysql数据库当中。
7)数据库通过NFS进行共享。
yum -y groupinstall "Development Tools" "Server Platform Development" #安装开发环境 yum -y install mariadb_server mariadb-devel openssl-devel pam-devel systemctl start mariadb.service mysql >SHOW DATABASE; >exit; systemctl enable mariadb.service tar xf pam_mysql_0.7RC1.tar.gz cd pam_mysql_0.7RC1/ ./configure --with-mysql=/usr --with-openssl=/usr --with-pam=/usr --with-pam-mods-dir=/lib64/security make && make install systemctl stop vsftpd.service cd /etc/vsftpd/ mv vsftpd.conf{,.test} cp vsftpd.conf.bak vsftpd.conf mysql >CREATE DATABASE vsftpd; >use vsftpd; >CREATE TABLE users( ->id int AUTO_INCREMENT NOT NULL PRIMARY KEY, ->name char(30) NOT NULL, ->password char(48) binary NOT NULL); >INSERT INTO users(name,password) VALUES('tom',password('123')); >INSERT INTO users(name,password) VALUES('jerry',password('123')); >SELECT * FROM users; >GRANT select ON vsftpd.* TO vsftpd@localhost IDENTIFIED BY '123'; >GRANT select ON vsftpd.* TO vsftpd@'127.0.0.1' IDENTIFIED BY '123'; >FLUSH PRIVILEGES; >exit; vim vsftpd.conf pam_service_name=vsftpd vim vsftpd.mysql #在/etc/pam.d/下创建配置文件 auth required pam_mysql.so usr=vsftpd passwd=123 host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2 account required pam_mysql.so usr=vsftpd passwd=123 host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2 useradd -s /sbin/nologin -d /ftproot vuser chmod go+rx /ftproot/ vim /etc/vsftpd/vsftpd.conf pam_service_name=vsftpd.mysql guest_enable=YES guest_username=vuser chroot_local_user=YES systemctl start vsftpd.service
原创文章,作者:N22_Elephant,如若转载,请注明出处:http://www.178linux.com/54526