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网络的主机访问;
~]#yum install -y samba samba-client ~]#mkdir /data ~]#groupadd develop ~]#useradd -G develop gentoo -p gentoo ~]#useradd -G develop centos -p centos ~]#useradd ubuntu -p ubuntu ~]#smbpasswd -a gentoo New SMB password: Retype new SMB password: Added user gentoo. ~]#smbpasswd -a centos New SMB password: Retype new SMB password: Added user centos. ~]#smbpasswd -a ubuntu New SMB password: Retype new SMB password: Added user ubuntu. ~]#chgrp develop /data ~]#chmod g+w /data ~]#cat /etc/samba/smb.conf [global] workgroup=magedu [shared] comment = data path=/data browseable = no write list=@develop hosts allow=172.16.0.0/16 ~]#systemctl start nmb ~]#systemctl start smb
测试
~]#smbclient //10.211.55.35/shared -U gentoo Enter gentoo's password: Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-36.el6_8] smb: \> ls . D 0 Mon Feb 20 01:47:42 2017 .. DR 0 Thu Mar 23 23:43:54 2017 my D 0 Mon Feb 20 00:49:55 2017 hosts N 160 Tue Feb 14 16:46:32 2017 51475068 blocks of size 1024. 42181944 blocks available smb: \> lcd /etc/ smb: \> put hosts.deny putting file hosts.deny as \hosts.deny (149.7 kb/s) (average 149.7 kb/s) ~]#smbclient //10.211.55.35/shared -U ubuntu Enter ubuntu's password: Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-36.el6_8] smb: \> ls . D 0 Fri Mar 24 05:55:26 2017 .. DR 0 Thu Mar 23 23:43:54 2017 my D 0 Mon Feb 20 00:49:55 2017 hosts N 160 Tue Feb 14 16:46:32 2017 hosts.deny A 460 Fri Mar 24 05:55:26 2017 51475068 blocks of size 1024. 42181932 blocks available smb: \> lcd /etc smb: \> put hosts.allow NT_STATUS_ACCESS_DENIED opening remote file \hosts.allow smb: \> get hosts.deny getting file \hosts.deny of size 460 as hosts.deny (224.6 KiloBytes/sec) (average 224.6 KiloBytes/sec)
2、搭建一套文件vsftp文件共享服务,共享目录为/ftproot,要求:(描述完整的过程)
- 1)基于虚拟用户的访问形式;
- 2)匿名用户只允许下载,不允许上传;
- 3)禁锢所有的用户于其家目录当中;
- 4)限制最大并发连接数为200:;
- 5)匿名用户的最大传输速率512KB/s
- 6)虚拟用户的账号存储在mysql数据库当中。
- 7)数据库通过NFS进行共享。
先做nfs ~]#yum install -y nfs-utils rpcbind ~]#systemctl start rpcbind ~]#systemctl start nfs.service ~]#mkdir /mysqldata ~]#groupmod -g 3306 mysql ~]#usermod -u 3306 mysql ~]#chown -R mysql.mysql /mysqldata ~]#cat /etc/exports /mysqldata 10.211.55.35(rw,sync) ~]#exportfs -r
nfs挂载并启动mariadb ~]# showmount -e 10.211.55.24 Export list for 10.211.55.24: /mysqldata 10.211.55.35 ~]#mount -t nfs 10.211.55.24:/mysqldata /mysqldata ~]#groupmod -g 3306 mysql ~]#usermod -u 3306 mysql ~]#su - mysql ~]#cd /usr/local/mariadb/scripts ~]#./mysql_install_db --basedir=/usr/local/mariadb --datadir=/mysqldata --user mysql ~]#cp ../support_files/my-huge.cnf /etc/my.cnf ~]#cat /etc/my.cnf [mysqld] datadir=/mysqldata ~]#cp ../support_files/mysql.server /etc/init.d/mysqld ~]#service mysqld start
配置vsftpd虚用户访问 ~]#yum install -y vsftpd ~]#mysql MariaDB [vsftpd]> desc users; +--------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | char(30) | NO | | NULL | | | passwd | char(48) | NO | | NULL | | +--------+----------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) MariaDB [vsftpd]> insert into users (name,passwd) values ('jusene',password('jusene')); Query OK, 1 row affected (0.02 sec) MariaDB [vsftpd]> insert into users (name,passwd) values ('tom',password('tom')); Query OK, 1 row affected (0.00 sec) MariaDB [vsftpd]> select * from users; +----+--------+-------------------------------------------+ | id | name | passwd | +----+--------+-------------------------------------------+ | 1 | jusene | *F4FC8B2A0A53CB6EB68F6F87B760AE616E8E2A78 | | 2 | tom | *71FF744436C7EA1B954F6276121DB5D2BF68FC07 | +----+--------+-------------------------------------------+ 2 rows in set (0.00 sec) ~]#cd pam_mysql ~]#./configure --with-mysql=/usr/local/mysql --with-openssl --with-pam=/usr --with-pam-mods-dir=/lib64/security ~]#make && make install ~]#cd /lib64/security/ ~]#ll pam_mysql.so ~]#cat /etc/pam.d/vsftpd.mysql auth required pam_mysql.so user=vsftpd passwd=vsftpd host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=passwd crypt=2 account required pam_mysql.so user=vsftpd passwd=vsftpd host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=passwd crypt=2 ~]# useradd -s /sbin/nologin -d /ftpdata vuser ~]# cat /etc/vsftpd/vsftpd.conf anonymous_enable=YES anon_upload_enable=NO max_clients=200 anon_max_rate=512K chroot_local_user=YES
原创文章,作者:N25_随心,如若转载,请注明出处:http://www.178linux.com/72553
评论列表(1条)
写的很好,看着你的博客完全可以自己配置出来,希望可以再接再厉,继续保持