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

Installation and use of ftp for Linux

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Installation and use of ftp for Linux

Installation and configuration of FTP server (Ubuntu)

1. Query whether to install vsftpd: rpm-qa | grep vsftpd

(installation of rpm: apt-get install rpm)

Or query the current ftp process: ps-ef | grep vsftpd

two。 Install vsftpd server: rpm-ivh vsftpd-*.rpm or find the corresponding resources from the Internet to install vsftpd:apt-get install vsftpd directly

+ +

You can install the package online by configuring yum.

[root@szmspv1 yum.repos.d] # pwd

/ etc/yum.repos.d

[root@szmspv1 yum.repos.d] # more rhel54.repo

[Server]

Name=Red Hat Enterprise Linux Server

Baseurl= ftp://172.26.0.11/Server64/

Enabled=1

Gpgcheck=1

Gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

+ + +

3. test

Root@localhost root:~# ftp localhost

Connected to localhost.

220 (vsFTPd 2.2.2)

Name (localhost:root): root

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp > bye

221 Goodbye.

Start, stop, restart, status of 4.vsftpd server

Service vsftpd start or. / etc/init.d/vsftpd start

Service vsftpd stop or. / etc/init.d/vsftpd stop

Service vsftpd restart or. / etc/init.d/vsftpd restart

Service vsftpd status or. / etc/init.d/vsftpd status

Three main configuration files for 5.vsftpd

/ etc/vsftpd.conf / / main configuration file for the server

/ etc/ftpd.ftpusers / / users in this file cannot access the vsftpd server

/ etc/vsftpd.user_list / / access may be denied, service yelled or access allowed

Configuration parameters of 6.vsftpd.conf

Anonymous_enable=YES / / enable anonymous users

Local_enable=YES / / allow local users to access the vsftpd server

Write_enable=YES / / allow upload

Download_enable=YES / / allow download

Anon_upload_enable=YES / / allow anonymous users to upload

Anon_mkdir_write_enable=YES / / allows anonymous users to create directories and upload

Anon_other_write_enable=NO / / Anonymous users are not allowed to delete and rename

Local_max_rate=20000 / / the maximum transfer rate of the local user in bytes per second

Maximum transfer rate of anon_max_rate=5000 / / anonymous users in bytes per second

Local_umask=022 / / remove write permission

File_open_mode=0666 / / permission to upload files

Xferlog_enable=YES / / maintain log files and record upload and download operations in detail

Xferlog_std_format=YES / / transfer log files will be written in standard xferlog format. Log files are default.

Think / var/log/xferlog

Hide_ids=YES / / hide folder and directory owners

Port_enable=YES / / active transfer mode is allowed

Pasv_min_port= (1024 > / etc/vsftpd.user_list)

Phenomenon 3:

500 OOPS: cannot open chroot () user list file

Login failed.

Reason: the file "/ etc/vsftpd.chroot_list" does not exist

Solution: # echo username > > / etc/vsftpd.chroot_list

Phenomenon 4:

500 OOPS: missing value in config file

Connection closed by remote host.

Reason: there is a problem with the value before the "=" equal sign, or there is only one space.

Solution: just modify the corresponding value, and maybe go through diff to compare and find.

Phenomenon 5:

500 OOPS: bad bool value in config file

Connection closed by remote host.

Reason: there is a problem with the value after the "=" equal sign

Solution: confirm the modification after the "=" equal sign

Phenomenon 6:

500 OOPS: unrecognised variable in config file

Connection closed by remote host.

Reason: there is a space before the parameter

Solution: delete the space before the parameter

Phenomenon 7.

Confirm that "local_enable=YES" exists, but local users cannot log in

Reason: verification parameter was mistakenly deleted

Solution: add "pam_service_name=vsftpd"

Phenomenon 8.

500 OOPS: chdir

500 OOPS: child died

Connection closed by remote host.

Reason: the user's home directory has no permissions or no home directory

Solution: set the user's home directory permissions correctly

Steps for setting up 9.vsftpd virtual user account

(1)。 Create a virtual user password library file

Vi / pub/vu_list.txt

Wang5

one hundred and twenty three

Zhao6

four hundred and fifty six

(2)。 Generate the authentication file of vsftpd

Db_load-T-t hash-f / pub/vu_list.txt / etc/vsftpd/vu_list.db

Chmod 600 / etc/vsftpd/vu_list.db

(3)。 Create PAM profiles required by virtual users

Vi / etc/pam.d/vsftpd.vu

Auth required / lib/security/pam_userdb.so db=/etc/vsftpd/vu_list

Account required / lib/security/pam_userdb.so db=/etc/vsftpd/vu_list

(4)。 Establish the directory to be accessed by the virtual user and set the appropriate permissions

Useradd ftpuser

(5)。 Set up the vsftpd.conf profile

Guest_username=ftpuser

Pam_service_name=vsftpd.vu

(6)。 Restart the vsftpd server

Service vsftpd restart

10. Set different permissions for virtual users

(1)。 Set up the vsftpd.conf file

User_config_dir=/etc/vsftpd_vu

(2)。 Create a directory

Mkdir / etc/vsftpd_vu

(3)。 Enter the directory for editing

Cd / etc/vsftpd_vu

Vi wang5

Anon_world_readable_only=NO

Anon_upload_enable=YES

Anon_mkdir_write_enable=YES

Anon_other_write_enable=YES

Vi zhao6

Anon_world_readable_only=YES

Anon_upload_enable=NO

Anon_mkdir_write_enable=NO

Anon_other_write_enable=NO

10. Configure a virtual ftp server based on IP

(1)。 Bind other IP

Ifconfig eth0:0 192.168.1.71

(2)。 Create a virtual FTP server directory

Mkdir-p / var/ftp2/pub1

(3)。 Local users mapped by anonymous users who create virtual servers

Ftp2

Useradd-d / var/ftp2-M ftp2

(4)。 Modify the configuration file of the original stand-alone server

Listen_address=192.168.1.70

(5)。 Copy the master configuration file that generates the virtual server

Cp / etc/vsftpd.conf / etc/vsftpd/vsftpd2.conf

(6)。 Set the IP of the virtual server and map the anonymous user of the virtual server to the local user ftp2

Vi / etc/vsftpd/vsftpd2.conf

Pam_service_name=vsftpd

Listen_address=192.168.1.71

Ftp_username=ftp2

(7)。 Restart service takes effect: service vsftpd restart

Use the ftp command under DOS:

1. Switch to the specified directory

two。 Connect to the target ftp server: ftp 10.137.97.29

3. Enter account number and password

4. Switch transmission mode, binary transmission uses bin command

5. Upload file: put test_setup.zip

Download file: get * * .zip

6. Exit ftp:bye

7. Cd changes directories

8. Del deletes files

9. Dir to view the current directory of the remote host

10. Ascii uses ascii to transfer files

11. Mput, mget: upload or download multiple files

12. Mkdir sets up a directory on the remote host

13. Pwd displays the current working directory path of the remote host

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

Servers

Wechat

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

12
Report