Install FTP server for Ubuntu 14.04

install   Install the ftp server with th...
Modify profile
The client logs in to the server,
Modify profile
Client login server
Modify overall configuration
Configure per user information
Client login server
install

  Install the ftp server with the following command

sudo apt install vsftpd

Software management

Software management mode

start-up

service vsftpd start

restart

service vsftpd restart

stop it

service vsftpd stop

View status

service vsftpd status

Anonymous access method

Modify profile

gedit /etc/vsftpd.conf

  And write the configuration (overwrite the original 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

Finally, enter ls. If the effect shown in the figure first appears, it means that it is created

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.171.128

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 ubuntu, write ubuntu 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

  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

t

Connect to server under folder

Access under window

So far, all three ftp modes have been configured and practiced

10 November 2021, 06:47 | Views: 4193

Add new comment

For adding a comment, please log in
or create account

0 comments