Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Create logical volumes and configure ftp

Shulou Source: shulou.com Published: 2022-06-01 06:30:52 10月03日 Update

1. Create the user teacher and specify the home directory as / ftproot and the password set to pwd@123 (5 points)

[root@localhost] # useradd-d / ftproot teacher

[root@localhost ~] # echo pwd@123 | passwd-- stdin teacher

[root@localhost ~] # grep teacher / etc/passwd

two。 Create a logical volume / dev/ftp_vg/ftp_lv with a size of 45G using / dev/sd {bforce c ftproot d} and mount it permanently to the / volume directory. (30 points)

[root@localhost ~] # fdisk-cu / dev/sdb

[root@localhost ~] # fdisk-cu / dev/sdc

[root@localhost ~] # fdisk-cu / dev/sdd

[root@localhost ~] # pvcreate / dev/sd {bpene cpene d} 1

[root@localhost ~] # vgcreate / dev/ftp_vg / dev/sd {brecronomec d} 1

[root@localhost] # lvcreate-n / dev/ftp_vg/ftp_lv-L 45G

[root@localhost ~] # mkfs.ext4 / dev/ftp_vg/ftp_lv

[root@localhost ~] # vi / etc/fstab

/ dev/ftp_vg/ftp_lv / ftproot ext4 defaults 0 0

: wq

[root@localhost] # mount-a

[root@localhost ~] # mount

3. Install and configure ftp for the school according to the following requirements:

1) there are three directories under the ftp root directory:

Benet5.2 requires all students to upload assignments (upload files cannot be: * .rmvb,*.mp3,*.avi,*.exe) but cannot be downloaded, and teacher is required to authorize and download student assignments to the directory; (20 points)

Public requires sharing of 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)

2) access the test and verify it. (5 points)

Configuration items added by the main profile:

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:

[root@localhost ~] # yum-y install vsftpd

[root@localhost ~] # vi / etc/vsftpd/vsftpd.conf

:% g / ^ # / d (delete comments)

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

Add the following:

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

[root@localhost ~] # chown teacher:teacher / ftproot/

[root@localhost ~] # rm-rf / ftproot/*

[root@localhost ~] # chmod 755 / ftproot/

[root@localhost ~] # / etc/init.d/vsftpd start

[root@localhost ~] # chkconfig vsftpd on

Windows accesses ftp, uses teacher users to log in and create Benet5.2, Public, Teacher directories, establishes class directories and authorizes them under Benet5.2, uploads resources to Public and Teacher directories, and closes the window.

[root@localhost ~] # chmod 700 / ftproot/Teacher/ # # Authorization

Access Test:

Anonymous access, upload jobs, download jobs, download resources in Public, visit teacher.

Tags: Directories assignments configurations students files users resources tests logic three uploads and downloads downloads contents only size learning materials schools passwords everyone root directory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi MariaDB NVidia Linux