Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a small ftp service

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to build a small ftp service, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Experimental results (can be screenshots):

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.

The above is how to build a small ftp service, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report