ftp deployment installation

```
sudo sh -c "yum -y install vsftpd"
```
### 生产配置参考 vsftpd.conf

```

#/etc/vsftpd/vsftpd.conf

listen_port=3721
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
chroot_local_user=YES
listen=YES
pam_service_name=www
userlist_enable=YES
tcp_wrappers=YES
guest_enable=YES
guest_username=ftp
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vuser_conf
ascii_upload_enable=YES
ascii_download_enable=YES
xferlog_file=/var/log/xferlog
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
pasv_enable=YES
pasv_min_port=3722
pasv_max_port=3999
pasv_promiscuous=YES  
pasv_address=35.241.95.93
port_enable=YES
accept_timeout=60
connect_timeout=60
data_connection_timeout=120
allow_writeable_chroot=YES
```

### 生产配置参考 vuser_conf 文件夹
```
[maintenanceuser@localhost ~]$ cd /etc/vsftpd/
[maintenanceuser@localhost ~]$  mkdir vuser_conf
[maintenanceuser@localhost vuser_conf]$ ls -lrt Agsmcimg2016
-rw-r--r--. 1 root root 182 Jun 26  2017Agsmcimg2016 
[maintenanceuser @ localhost vuser_conf] $ CAT Agsmcimg2016 
local_root = / Home / wwwroot / 
anonymous_enable = NO 
write_enable = YES 
anon_umask = 022 
anon_world_readable_only = NO 
anon_upload_enable = NO 
anon_mkdir_write_enable = NO 
anon_other_write_enable = NO 
`` ` 

# ## generates a random number code 
openssl rand -base64 10 # ## The process of establishing a virtual user 
- odd lines are the user name, even numbers are the password " 
` 
[maintenanceuser @ localhost vsftpd] $ pwd / etc /


 vsftpd
[maintenanceuser vsftpd @ localhost] $ sudo CAT vuser_passwd.txt 
Agsmcimg2016 
the Img # 0945foralist # All 
`` `
 - generated virtual database file 
` `` 
# db_load not installed by default, yum installdb4-utils db4-devel db4 installed in order to use 
[root @ 47 -75-151-22 vsftpd] # yum install -y db4-utils db4-devel db4 
[root @ 47-75-151-22 vsftpd] # db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt / etc / the vsftpd / vuser_passwd.db 
`` ` 

# ## 
- /etc/pam.d/ the vsftpd 
` `` 
the auth Sufficient    /lib64/security/pam_userdb.so DB = / etc / the vsftpd / vuser_passwd 
Account Sufficient   /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
#auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd
##account required pam_userdb.so db=/etc/vsftpd/vuser_passwd

```

### 登陆验证
```
sudo systemctl restart vsftpd

[maintenanceuser@69 ~]$ ftp
ftp> open 192.168.86.41 3721
Connected to 192.168.86.41 (192.168.86.41).
220 (vsFTPd 3.0.2)
Name (192.168.86.41:maintenanceuser): Agsmcimg2016
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,86,41,15,118).
150 Here comes the directory listing.
drwxr-xr-x    2 14       50              6 Sep 05 05:40 api
drwxr-xr-x    9 14       50            102 Aug 29 01:55 e68
drwxr-xr-x    5 14       50             48 Aug 07 08:49 friend
drwxr-xr-x    8 14       50           8192 Aug 29 01:55 long8
drwxr-xr-x    8 14       50            129 Aug 23 02:00 public
drwxr-xr-x    7 14       50            119 Aug 28 09:19 ql
drwxr-xr-x    6 14       50             59 Apr 10 09:04 qy8
drwxr-xr-x    7 14       50            133 Aug 23 02:00 uf
drwxr-xr-x    7 14       50            133 Aug 23 01:59 ul
drwxr-xr-x    5 14       50             47 Feb 01  2019 yahu
drwxr-xr-x    7 14       50            105 Aug 23 01:54 zb
226 Directory send OK.
ftp> ^Z
[4]+  Stopped                 ftp



[maintenanceuser@localhost ~]$ sftp [email protected]
Connecting to 222.186.169.42...
jasonapi@222.186.169.42's password:
sftp> ls

```

 

Guess you like

Origin www.cnblogs.com/rockyricky/p/12298849.html