Linux to build our school FTP service

Source: Internet
Author: User

1. Create user teacher and specify their home directory as/ftproot, password set to [email protected] (5 points)

[Email protected] ~]# useradd-d/ftproot teacher

[Email protected] ~]# echo [email protected] |passwd--stdin teacher

[[email protected] ~]# grep teacher/etc/passwd

To create its home directory:

650) this.width=650; "title=" clip_image002 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-ydtzxelfaaaosczztka791.jpg "" 244 "height="/>

Create users and make their home directories:

650) this.width=650; "title=" clip_image004 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiol1e-ydxtr19vaaaov0tdyxa260.jpg "" 244 "height="/>

Set Password:

650) this.width=650; "title=" clip_image006 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-ydwjv7c6aaasz7garaq185.jpg "" 244 "height="/>

To view user information:

650) this.width=650; "title=" clip_image008 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiol1e-ydaazmgaaaaumpadqtc765.jpg "" 244 "height="/>

2. Use/dev/sd{b,c,d} to create a logical volume with size 45G/dev/ftp_vg/ftp_lv and mount it permanently to the/ftproot directory. (30 points)

[Email protected] ~]# Fdisk-cu/dev/sdb

[Email protected] ~]# FDISK-CU/DEV/SDC

[Email protected] ~]# FDISK-CU/DEV/SDD

[Email protected] ~]# pvcreate/dev/sd{b,c,d}1

[Email protected] ~]# vgcreate/dev/ftp_vg/dev/sd{b,c,d}1

[Email protected] ~]# lvcreate-n/dev/ftp_vg/ftp_lv-l 45G

[Email protected] ~]# MKFS.EXT4/DEV/FTP_VG/FTP_LV

[Email protected] ~]# Vi/etc/fstab

/dev/ftp_vg/ftp_lv/ftproot EXT4 Defaults 0 0

: Wq

[Email protected] ~]# mount-a

[email protected] ~]# mount

To partition a disk:

650) this.width=650; "title=" clip_image010 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image010 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-ydeihdgyaaavj5jzpe8444.jpg "" 244 "height=" 135 "/>

650) this.width=650; "title=" clip_image012 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image012 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiol1e-ydei8xn-aabcruvt0wu162.jpg "" 244 "height=" 154 "/>

T is to set the partition type, L is to view all types, 8e is LVM type, W save

The steps for B,c,d disks are roughly the same

To create a logical Volume:

650) this.width=650; "title=" clip_image014 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image014 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiol1e-ydibwykyaaaj2i4tvs8569.jpg "" 244 "height="/>

To create a volume group:

650) this.width=650; "title=" clip_image016 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image016 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiom1e-yd-b4z2caaatbaoioo4543.jpg "" 244 "height="/>

To create a logical volume and set the size:

650) this.width=650; "title=" clip_image018 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image018 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiom1e-yd-rbkzwaaapcjl1ouw411.jpg "" 244 "height="/>

Formatting:

650) this.width=650; "title=" clip_image020 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image020 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-yedb2qlqaaaosb5_hwm056.jpg "" 244 "height="/>

Permanent Mount:

650) this.width=650; "title=" clip_image022 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image022 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-yecjnkufaaaqygra2ve732.jpg "" 244 "height=" 144 "/>

Verify:

650) this.width=650; "title=" clip_image024 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image024 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiol1e-yegqzniraaam5bidozm708.jpg "" 217 "height="/>

650) this.width=650; "title=" clip_image026 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image026 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-yegidjloaaa0e1gtw7s542.jpg "" 244 "height=" 98 "/>

3. Install and configure the FTP for the school as per the following requirements:

1) There are three directories in the FTP root directory:

Benet5.2 requires all learners to be able to upload a job (upload file cannot be: *.rmvb,*.mp3,*.avi,*.exe) but cannot download, and requires teacher to authorize the directory and download the trainee job; (20 points)

Public requires sharing learning materials, students can download can not upload, teacher can upload and download; (20 points)

The teacher directory is accessible only to teacher and not to anyone else. (20 points)

Installation Services:

650) this.width=650; "title=" clip_image028 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image028 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiol1e-yelhtgw4aaapqm9onlo650.jpg "" 244 "height="/>

To edit the master configuration file:

650) this.width=650; "title=" clip_image030 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image030 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiol1e-yewyeuknaaaod4eua1y896.jpg "" 244 "height="/>

650) this.width=650; "title=" clip_image032 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image032 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-yeaja7zdaabjb4ai_go543.jpg "" 201 "height=" 244 "/>

To set the owner of the home directory:

650) this.width=650; "title=" clip_image034 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image034 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/wKioL1e-YEbDzJV_ Aaaoi6djv3a109.jpg "" 244 "height="/>

Delete all of the directories:

650) this.width=650; "title=" clip_image036 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image036 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-yefzpzltaaamxudioim303.jpg "" 244 "height="/>

Set permissions:

650) this.width=650; "title=" clip_image038 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image038 "src=" Http://s3.51cto.com/wyfs02/M01/86/6A/wKioL1e-YEfSbo_ Laaaoruxcde4499.jpg "" 244 "height="/>

To the Class directory authorization:

650) this.width=650; "title=" clip_image040 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image040 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/wKioL1e-YEiD_ Sy-aaans0tk8r4225.jpg "" 244 "height="/>

650) this.width=650; "title=" clip_image042 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image042 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-yevhhbd4aaasxkfvmvi852.jpg "" 193 "height=" 244 "/>

To Teacher directory authorization:

650) this.width=650; "title=" clip_image044 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image044 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-yevrabclaaaos8wckqi532.jpg "" 244 "height="/>

Start the service:

650) this.width=650; "title=" clip_image046 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image046 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiom1e-yezagmccaaaluqgcjtw337.jpg "" 244 "height="/>

650) this.width=650; "title=" clip_image048 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image048 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiol1e-yeyqjtwoaaaopzqcncg318.jpg "" 244 "height="/>

Log in with teacher User:

650) this.width=650; "title=" clip_image050 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image050 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-ye2yjqlwaaasrut5c5y603.jpg "" 244 "height=" 191 "/>

To create a directory:

650) this.width=650; "title=" clip_image052 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image052 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-ye2qggdwaaanbwnmo-u689.jpg "" 244 "height="/>

650) this.width=650; "title=" clip_image054 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image054 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiom1e-ye7bqrxraaayoyzejyg665.jpg "244" height= "/>"

Upload resources:

650) this.width=650; "title=" clip_image056 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image056 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiom1e-ye7gmsfyaaaztim9st8548.jpg "" 244 "height="/>

650) this.width=650; "title=" clip_image058 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image058 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/wKioL1e-YE_ Yytdsaaazd9gtlww512.jpg "" 244 "height="/>

2) Access test and verify. (5 points)

Anonymous Identity login:

650) this.width=650; "title=" clip_image060 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image060 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/wKioL1e-YE_ Gqcheaaawwldpq3e539.jpg "" 244 "height=" 188 "/>

You can upload resources to the class directory but not download:

650) this.width=650; "title=" clip_image062 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image062 "src=" http://s3.51cto.com/wyfs02/M02/86/6A/ Wkiom1e-yfdhyni4aaavy65e_wa326.jpg "" 244 "height="/>

650) this.width=650; "title=" clip_image064 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image064 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiom1e-yfdcljiqaaarj3_kyvs484.jpg "" 244 "height="/>

Resources available for downloading public:

650) this.width=650; "title=" clip_image066 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image066 "src=" http://s3.51cto.com/wyfs02/M00/86/6A/ Wkiol1e-yfgdgizxaaakqufl0uq593.jpg "" 244 "height="/>

To access the teacher directory:

650) this.width=650; "title=" clip_image068 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image068 "src=" http://s3.51cto.com/wyfs02/M01/86/6A/ Wkiol1e-yfpqasr7aaaejxyruds012.jpg "" 244 "height=" "/>

The configuration items that are added by the master configuration file:

Anon_upload_enable=yes

Anon_mkdir_write_enable=no

Chown_uploads=yes

Chown_username=teacher

Chroot_local_user=yes

Anon_root=/ftproot

Deny_file={*.rmvb,*.mp3,*.avi,*.exe}

Recommended steps:

[Email protected] ~]# yum-y install VSFTPD

[Email protected] ~]# vi/etc/vsftpd/vsftpd.conf

:%g/^#/d (Delete comment)

:%g/^$/d (delete blank line)

Add the following content:

Anon_upload_enable=yes

Anon_mkdir_write_enable=no

Chown_uploads=yes

Chown_username=teacher

Chroot_local_user=yes

Anon_root=/ftproot

Deny_file={*.rmvb,*.mp3,*.avi,*.exe}

: Wq

[Email protected] ~]# chown teacher:teacher/ftproot/

[Email protected] ~]# rm-rf/ftproot/*

[Email protected] ~]# chmod 755/ftproot/

[[email protected] ~]#/etc/init.d/vsftpd start

[Email protected] ~]# chkconfig vsftpd on

Windows accesses FTP, uses teacher users to log in and creates Benet5.2, public, teacher directories, and establishes class directories under Benet5.2 and authorizes, uploads resources to public, teacher directories, and closes Windows.

[Email protected] ~]# chmod 700/ftproot/teacher/# #授权

Access test:

Anonymous access, upload jobs, download jobs, download resources in public, access teacher.

Linux to build our school FTP service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.