Linux FTP Service configuration

Source: Internet
Author: User
Tags ftp commands

1 FTP Service Build Environment

Server side:

CentOS Release 6.8 (Final)

IP 192.168.91.3

Hostname:darren

Client side:

CentOS Release 6.6 (Final)

IP 192.168.91.5

Hostname:zhishutang

2 server-side installation VSFTPD Service

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

[Email protected] packages]# Rpm-qa vsftpd

Vsftpd-2.2.2-21.el6.x86_64

[Email protected] ~]# chkconfig--level 2345 vsftpd on

[Email protected] ~]#/etc/init.d/vsftpd restart

#ftp服务默认为21端口

[Email protected] ~]# Netstat-nltup |grep vsftp

TCP 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 20334/vsftpd

[Email protected] ~]# Ps-ef |grep vsftp

Root 20334 1 0 12:42? 00:00:00/usr/sbin/vsftpd/etc/vsftpd/vsftpd.conf

3 client-side installation of FTP clients

[[email protected] packages]# yum-y install FTP

[[email protected] ~]# RPM-QA FTP

Ftp-0.17-54.el6.x86_64

4 Common Command parsing

[[email protected] home]# useradd User3--Create a test user on server side User3

[[Email protected] ~]# FTP--Login on client side

Ftp> Open 192.168.91.3--Specify server-side IP address with open

Connected to 192.168.91.3 (192.168.91.3).

(VsFTPd 2.2.2)

Name (192.168.91.3:root): User3--Enter user name

331 Specify the password.

Password:--Enter password

Successful Login.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp> Help-----view assistance, show all FTP commands

Commands may abbreviated. Commands is:

! Debug Mdir sendport Site

$ dir mget put size

Account Disconnect mkdir pwd status

Append exit MLS quit struct

ASCII Form Mode quote system

Bell get Modtime recv Sunique

Binary Glob mput reget Tenex

Bye hash Newer rstatus tick

Case Help Nmap Rhelp Trace

CD Idle nlist rename type

Cdup image Ntrans Reset User

chmod LCD Open Restart Umask

Close LS prompt rmdir verbose

CR macdef Passive Runique?

Delete Mdelete proxy send

Ftp> Close-Disconnects client and server FTP connections without exiting the FTP shell

OOPS:vsf_sysutil_recv_peek:no data

Ftp> Disconnect--same as close function

221 Goodbye.

Ftp> Open 192.168.91.3 21--Specify IP address and port, if default port 21, do not specify

Ftp> Bye--Disconnects the client and server FTP connections and exits the FTP shell (features with quit and!). )

OOPS:vsf_sysutil_recv_peek:no data

Help command:? Help Rhelp

ftp> ASCII

Switching to ASCII mode.

ftp> binary

Switching to Binary mode.

Toggles the ringing to ring after each file transfer command completes. By default, the ringtone is turned off.

Ftp> Bell

Bell mode on.

Ftp> Bell

Bell mode off.

Ftp> cd/tmp--Switch Remote server directory

Directory successfully changed.

Ftp> Cdup--jump to the previous level directory

Directory successfully changed.

ftp> pwd--Displays the directory on the remote server

257 "/"

Ftp> lcd/tmp--Specify the directory on the local computer to change

Local Directory Now/tmp

Ftp>ls--Displays remote server directory files and subdirectories

Ftp> DIR--Displays remote server directory files and subdirectories

Ftp> Size/tmp/root.txt--Displays the size of the remote server file 12922KB

213 12922

Ftp> Mkdir/tmp/ftpdir--Create a remote service end directory

257 "/tmp/ftpdir" created

Ftp> Rmdir/tmp/ftpdir--Delete remote service end directory

Remove Directory operation successful.

Ftp> Rename/tmp/file/tmp/fileuser3--Modify the remote server file name

For Rnto.

Rename successful.

ftp> chmod 755/tmp/fileuser3--Modify remote server file permissions

$ SITE CHMOD command OK.

Ftp> modtime Fileuser3--Displays the last modified time of a file on a remote server

Fileuser3 11/15/2016 08:12:21 GMT

Ftp> Append/home/file/tmp/file--uploading a local file to a file on a remote computer

Local:/home/file Remote:/tmp/file

227 Entering Passive Mode (192,168,91,3,113,93).

Ok to send data.

226 Transfer complete.

Ftp> Send/home/file/tmp/file--uploading a local file to a file on a remote computer

Local:/home/file Remote:/tmp/file

227 Entering Passive Mode (192,168,91,3,99,109).

Ok to send data.

226 Transfer complete.

Ftp> Put/home/file/tmp/file--uploading a local file to a file on a remote computer

Local:/home/file Remote:/tmp/file

227 Entering Passive Mode (192,168,91,3,56,26).

Ok to send data.

226 Transfer complete.

Local:/tmp/file remote:/tmp/file----To download files from a remotely computer to a local file

227 Entering Passive Mode (192,168,91,3,62,156).

Opening BINARY Mode data connection for/tmp/file (0 bytes).

226 Transfer complete.

ftp> recv/tmp/file/tmp/file----Download files from a remote computer to a local file

Local:/tmp/file Remote:/tmp/file

227 Entering Passive Mode (192,168,91,3,139,114).

Opening BINARY Mode data connection for/tmp/file (0 bytes).

226 Transfer complete.

Ftp> Delete/tmp/file--delete a file on a remote computer

+ Delete operation successful.

Ftp> Umask

Your Current UMASK is 022

Ftp>prompt--Switch The conversational instruction (use Mput/mget without asking for each file yes/no)

There are too many commands to demonstrate.

5 Description of the FTP configuration file

/etc/vsftpd/ftpusers--Users in this file cannot log in to FTP by default

/etc/vsftpd/user_list--If userlist_deny=yes in profile/etc/vsftpd/vsftpd.conf (default), the user in this file/etc/vsftpd/user_list does not Can login FTP, if userlist_deny=no, this file/etc/vsftpd/user_list user can log in FTP,

/etc/vsftpd/vsftpd.conf--Main configuration file

For example: The default root is not able to log on FTP, here to modify the configuration file, so that the root user is available

[Email protected] vsftpd]# vim/etc/vsftpd/ftpusers

#root--Note root user

[Email protected] vsftpd]# vim/etc/vsftpd/user_list

#root--Note root user

6 Primary configuration file/etc/vsftpd/vsftpd.conf

Since this file is more important, it is analyzed separately here

################ #本地用户权限控制 ###############

# allow local users to log on

Local_enable=yes

# Write permissions for Local Users

Write_enable=yes

# Local file permissions using FTP, default to 077

# generally set to 022

local_umask=022

# when switching directories

# whether to display the contents of the. Message in the directory

Dirmessage_enable=yes

Dirlist_enable = NO

#验证方式

#pam_service_name =vsftpd

# Enable data connections for FTP data ports

Connect_from_port_20=yes

# Run as a standalone FTP service

Listen=yes

# Modify the connection port

#listen_port =2121

######### Anonymous Login Settings ###########

# Allow Anonymous Logon

Anonymous_enable=no

# If Anonymous Logon is allowed

# Whether to turn on anonymous upload permission

#anon_upload_enable =yes

# If Anonymous Logon is allowed

# whether to allow anonymous folder creation and upload files within folders

#anon_mkdir_write_enable =yes

# If Anonymous Logon is allowed

# Anonymous accounts can have delete permissions

#anon_other_write_enable =yes

# If Anonymous Logon is allowed

# Anonymous Download permissions

# Anonymous for other, can set directory/File attribute control

#anon_world_readable_only =no

# If Anonymous Logon is allowed

# Limit anonymous user transfer rate, Unit bite

#anon_max_rate =30000

######### User throttling Settings ###########

# # # Limit Login

# Use UserList to restrict user access

#userlist_enable =yes

# People in the list are not allowed to visit

#userlist_deny =no

# Limit the path to the list file placement

#userlist_file =/etc/vsftpd/userlist_deny.chroot

# # # Limit Directory

# Restrict all users to the home directory

#chroot_local_user =yes

# Call a list of users who restrict home directories

Chroot_list_enable=yes

# Limit the path to the list of users in your home directory

Chroot_list_file=/etc/vsftpd/chroot_list

######### Log Settings ###########

# Log file path settings

Xferlog_file=/var/log/vsftpd.log

# activate the upload/download log

Xferlog_enable=yes

# Use the standard log format

#xferlog_std_format =yes

######### Security Settings ###########

# User Idle timeout, per second

#idle_session_timeout =600

# Data Connection idle timeout, per second

#data_connection_timeout =120

# Disconnect the client after 1 minutes of idle

#accept_timeout =60

# Reconnect after 1 minutes of interruption

#connect_timeout =60

# Local user transfer rate, Unit bite

#local_max_rate =50000

# Maximum number of connections for FTP

#max_clients =200

# Maximum number of connections per IP

#max_per_ip =5

######### Passive Mode setting ###########

# Whether to open a passive mode

Pasv_enable=yes

# Passive Mode min port

pasv_min_port=5000

# Passive Mode maximum port

pasv_max_port=6000

######### Other Settings ###########

# Welcome Information

Ftpd_banner=welcome to FTP server!

7 Configuring anonymous FTP


To modify a configuration file:

[Email protected] ftp]# vim/etc/vsftpd/vsftpd.conf

Anonymous_enable=yes

Anon_upload_enable=yes

Anon_mkdir_write_enable=yes

anon_root=/var/ftp/

Other parameters are not changed by default

FTP is a system User:

[[email protected] vsftpd]# cat/etc/passwd|grep FTP

Ftp:x:14:50:ftp User:/var/ftp:/sbin/nologin

[[Email protected] ~]# FTP

Ftp> Open 192.168.91.3

Connected to 192.168.91.3 (192.168.91.3).

(VsFTPd 2.2.2)

Name (192.168.91.3:root): FTP--Using FTP user

331 Specify the password.

Password:--no password, enter directly

Successful Login.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> pwd

257 "/"

Ftp> ls

227 Entering Passive Mode (192,168,91,3,203,117).

Here comes the directory listing.

Drwxr-xr-x 2 0 0 4096 Nov 10:38 anon

-rw-r--r--1 0 0 Nov 11:36 file1

-rw-r--r--1 0 0 0 Nov 11:47 file2

Drwxr-xr-x 2 0 4096

226 Directory send OK.

ftp> get/file1/tmp/file1--Download file file1

Local:/tmp/file1 Remote:/file1

227 Entering Passive Mode (192,168,91,3,196,32).

Opening BINARY Mode data connection for/file1 (0 bytes).

226 Transfer complete.


This article is from the "10979687" blog, please be sure to keep this source http://10989687.blog.51cto.com/10979687/1873414

Linux FTP Service configuration

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.