ftp server build
Laboratory personality can buy a good workstation, intended to git and ftp server as a laboratory to do some configuration, stepped on a few pit, finally somehow, mark it
Installation ftp
sudo apt-get install vsftpd
Configuration
In installed vsftpd
, it will produce a vsftpd.conf file in the / etc directory, this file is the ftp configuration file,
use
sudo vi /etc/vsftpd.conf
for editing
I did a column about the configuration
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=NO
ftpd_banner=Welcome to xitongzu FTP service.
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
It should be noted that there are several configuration to do some introduction:
- anonymous_enable = NO // disable anonymous login
- Permissions local_umask = 022 // create a file folder, the default is 077, will cause the folder you created only read access, no write permission, there is no access to the configuration where 022 users can CRUD and folders upload and download files
- xferlog_enable = YES // logging for uploading and downloading
- ftpd_banner = Welcome to xitongzu FTP service. // ftp enter the welcome message
Because this server is the presence of multiple users, I expect only one named ftp
user can log in and access the ftp service, we made the following configuration
* chroot_local_user = NO // disable all restrictions limit the user's home directory
* chroot_list_enable = YES / / set limits user access list
* chroot_list_file = / etc / vsftpd.chroot_list // limit specified list file
And created under / etc vsftpd.chroot_list
files to remove the root , the FTP write all user names go outside
Ftp server restart
sudo service vsftpd restart
Now you can by visiting ftp: // <ip> way to use the ftp service
This ftp server has built a good, but because of the workstation configuration is stored as a solid + 4T 1T machinery, solid-state memory file is too wasteful, so I intend to modify the ftp service storage location to the mechanical hard disk
Preconditions: Mount mechanical hard drive
By sudo fdisk -l
viewing the mechanical hard disk device name
It can be seen as a device /dev/sdb
, I took him to mount in the / data directory, execute
sudo mount /dev/sdb /data
Create folders for storing files, ftp
sudo mkdir /data/ftp
And / data users / ftp folder to be modifiedftp
sudo chown -R ftp /data/ftp/
Subsequent action:
To ftp access to route guidance /data/ftp
, i.e. / home / ftp catalog / data / ftp directory link
Using sudo mount --bind /data/ftp /home/ftp
command bindings
Such on / modify home / ftp directory (ftp file access) is actually / modify data / ftp directory