I tried to build an FTP server with CentOS 7.3 on the ESXi host. I will output the procedure for you who are looking at this article.
A server that sends and receives files using FTP.
item | Description |
---|---|
Hypervisor | ESXi6.7 |
OS | CentOS7.3 |
[root@tspweb01 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@tspweb01 ~]#
** * Minimal installation & the following settings have been implemented ** [Linux] Basic settings after OS installation of CentOS 7.3
First, create a user to connect by FTP.
[root@tspweb01 ~]# useradd ftp-user
[root@tspweb01 ~]# passwd ftp-user
User ftp-Change user password.
new password:
Please re-enter your new password:
passwd:All authentication tokens have been successfully renewed.
[root@tspweb01 ~]#
** ① Create directory for FTP **
[root@tspweb01 ~]# mkdir -p /var/www/ftp_dir
** ② Change the owner of the FTP directory **
ftp-user
the owner of the directory.[root@tspweb01 ~]# chown ftp-user /var/www/ftp_dir
** ③ Change the authority of the FTP directory **
[root@tspweb01 ~]# chmod 755 /var/www/ftp_dir
** ④ Check the FTP directory **
[root@tspweb01 ~]# ls -la /var/www | grep ftp
drwxr-xr-x. 2 ftp-user root 6 June 19 21:47 ftp_dir
[root@tspweb01 ~]#
--vsftpd
installation
yum -y install vsftpd
--vsftpd
installation confirmation
[root@tspweb01 ~]# rpm -qa | grep vsftpd
vsftpd-3.0.2-27.el7.x86_64
[root@tspweb01 ~]#
--FTP configuration file backup
[root@tspweb01 ~]# cp -p /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf_`date +'%Y%m%d'`
[root@tspweb01 ~]#
[root@tspweb01 ~]# ls -la /etc/vsftpd/
40 in total
drwxr-xr-x.2 root root 116 June 19 22:05 .
drwxr-xr-x.77 root root 8192 June 19 22:01 ..
-rw-------.1 root root 125 April 1 13:55 ftpusers
-rw-------.1 root root 361 April 1 13:55 user_list
-rw-------.1 root root 5116 April 1 13:55 vsftpd.conf
-rw-------.1 root root 5116 April 1 13:55 vsftpd.conf_20200619
-rwxr--r--.1 root root 338 April 1 13:55 vsftpd_conf_migrate.sh
[root@tspweb01 ~]#
--FTP settings
/etc/vsftpd/vsftpd.conf
#Confirm that there is the following description
~
## userlist_Enables the user specified in file (can connect)
userlist_enable=YES
##Access file (/etc/hosts.allow, /etc/hosts.deny)Is not used for access control
tcp_wrappers=NO
#Uncomment the following.
##Set local_Prohibit moving to directories above root
chroot_local_user=NO
##Enable chroot.
chroot_list_enable=YES
##Specifies the location of the chroot target user list file.
chroot_list_file=/etc/vsftpd/chroot_list
/etc/vsftpd/vsftpd.conf
#Add the following
##Allow passive mode connections
pasv_enable=YES
##Specify the IP address of the FTP server (when connecting in passive mode)
pasv_address=[FTP server IP]
* The above IP is fixed.
##Port specification
pasv_min_port=60001
pasv_max_port=60010
* If the port is a high port, there is no particular designation.
##Returns a list including files starting with a dot
force_dot_files=YES
##Display the time stamp of a file (or directory) in local time
use_localtime=YES
##Specify the location of the configuration file for each user.
user_config_dir=/etc/vsftpd/user_conf
/etc/vsftpd/chroot_list
ftp-user
Set the chroot to be "/ var / www / ftp_dir" when connecting with ftp-user
mkdir /etc/vsftpd/user_conf
vi /etc/vsftpd/user_conf/ftp-user
/etc/vsftpd/user_conf/ftp-user
local_root=/var/www/ftp_dir
systemctl start vsftpd
Start a command prompt from a Windows terminal and check the connection. There is no problem if you can log in to the FTP server as shown below.
C:\Users\owner>ftp 192.168.0.41
192.168.0.Connected to 41.
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
user(192.168.0.41:(none)): ftp-user ← Enter user name
331 Please specify the password.
password: ← password入力
230 Login successful.
ftp>
firewalld
service is stopped.By the way, the location of the root directory is as follows.
ftp> pwd
257 "/var/www/ftp_dir"
ftp>
[For beginners] Build an FTP server with CentOS 7
Recommended Posts