Install FTP server for Ubuntu 14.04

install

Install the ftp server with the following command

sudo apt install vsftpd

 

Software management

Software management mode

service vsftpd start   start-up
service vsftpd restart  restart
service vsftpd stop    stop it
service vsftpd status  View status

And write the configuration

anonymous_enable=YES
anon_root= /data/pub
local_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
#listen_ipv6=NO
pam_service_name=vsftpd
userlist_enable=NO
tcp_wrappers=YES

After configuration, create folders and files and restart the server

mkdir -p /data/pub
touch /data/pub/a.txt
chmod -R 777 /data
chmod a-w /data/pub
service vsftpd restart 

The client logs in to the server,



Command line login

ftp 127.0.0.1
 Then enter the user name
Anonymous
 Last input ls If the effect shown in the figure first appears, it means that the creation is successful

 

 

Connect to server under folder

Use the folder to access the server. Finally, you can see the file a.txt under the folder

 

 

 

Access under window

First, get the ip address of linux

ifconfig

  Next, enter the address under the file manager in the window

ftp://192.168.227.129

 

=System user access

Modify profile

1. Modify profile

gedit /etc/vsftpd.conf

And write the configuration  

anonymous_enable=NO
local_enable=YES
userlist_enable=YES
userlist_deny=NO

2. Write the user name that allows access

gedit /etc/vsftpd.user_list

  Add your own user. For example, if my computer user is chy001, write chy001 in the file

  Restart after configuration

service vsftpd restart  

Client login server

The ftp can also be accessed in three ways

Command line login

 

Connect to server under folder

 

Access under window

Virtual user access mode

 

Although the system user mode can control access, if there are too many users, it will affect the management of the server system and threaten the server security! And all we need is to use the FTP service built on the server!
Then we need to set up virtual users to log in, which is also the recommended way! This way is safer!

Virtual users do not have actual real system users, but realize access verification by mapping to one of the real users and setting corresponding permissions. Virtual users cannot log in to the Linux system, so as to make the system more secure and reliable.

Installation tools

Install the following tools to generate password account verification

sudo apt install db-util

Create account

Create an ftpuser account for the next experiment and modify the password

useradd ftpuser -s /sbin/nologin
passwd ftpuser 

  Modify overall configuration

gedit /etc/vsftpd.conf

And write the configuration  

anonymous_enable=NO
local_enable=YES
userlist_enable=YES
#userlist_deny=NO

guest_enable=YES
guest_username=ftpuser  #Consistent with the user name created earlier
virtual_use_local_privs=YES
pam_service_name=vsftpd
user_config_dir=/etc/vsftpd/virtualconf  #Remember this path

Create a configuration folder to store the configuration of each user

mkdir -p /etc/vsftpd/virtualconf

Create and store user password  

vi /etc/vsftpd/virtusers

  Deposit the account and password in the file

At the same time, use the db command to generate database files

db_load -T -t hash -f /etc/vsftpd/virtusers /etc/vsftpd/virtusers.db

Modify pam configuration file

gedit /etc/pam.d/vsftpd

Delete all the contents of the file and replace the following configuration

auth required /lib/x86_64-linux-gnu/security/pam_userdb.so db=/etc/vsftpd/virtusers
account required /lib/x86_64-linux-gnu/security/pam_userdb.so db=/etc/vsftpd/virtusers

Configure per user information

Switch to user configuration directory

mkdir -p /home/ftpuser/ftp1
chown ftpuser.ftpuser /home/ftpuser
cd /etc/vsftpd/virtualconf/
gedit ftp1

Write the following configuration in the file  

local_root=/home/ftpuser/ftp1
write_enable=YES
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES


At this point, the configuration is complete

Client login server

Restart the following ftp servers before logging in

service vsftpd restart

We now create a file in the shared directory for subsequent verification  

touch /home/ftpuser/ftp1/1.txt

Next, log in in in the same three ways

Command line login

You can see that 1.txt is the file just created

 

Connect to server under folder

 

 

  Access under window

 

 

Keywords: OpenCV Ubuntu server

Added by Mindwreck on Thu, 18 Nov 2021 10:12:09 +0200