Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

Ubuntu Server 22.04 : NTP , FTP Server(Vsftpd)

1. Install a time synchronization service NTP server

# apt -y install chrony
# vi /etc/chrony/chrony.conf
# Lines 20-23.:Comment the default settings and add the NTP server for your time zone.
#pool ntp.ubuntu.com     iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
pool ntp.nict.jp iburst
# Add to the last line (Range for which time synchronization is allowed)
allow 192.168.11.0/24
Settings reflect
# systemctl restart chrony
# operation check
# chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
=========================================================
^- ntp-b3.nict.go.jp 1 6 17 3 -79us[ -79us] +/- 5671us
^? ntp-a3.nict.go.jp 0 7 0 - +0ns[ +0ns] +/- 0ns
^? ntp-a2.nict.go.jp 0 7 0 - +0ns[ +0ns] +/- 0ns
^* ntp-k1.nict.jp 1 6 17 4 -229us[ -165us] +/- 3467us
^+ ntp-b2.nict.go.jp 1 6 17 4 +247us[ +311us] +/- 5348us

2. Install FTP server vsftpd

①Install

# apt install vsftpd

②Allow PORT 21 at UFW

# ufw allow ftp
# ufw reload

③Configuration File Changes

# vi /etc/vsftpd.conf

Line 14.
Listen=YES

Line 22.
Listen_ipv6=NO

Line 25.  # Do not allow anonymous users to log in
anonymous_enable=NO

Line 28.  # Allow login by local user accounts
local_enable=YES

Line 31.  # Allow use of FTP commands to make changes to files
write_enable=YES

Line 35.  # Set permission values to be applied to new files
local_umask=022

Line 99.  # Allow uploads by ASCII
ascii_upload_enable=YES

Line 100.  # Allow downloading by ASCII
ascii_download_enable=YES

Line 122.  # Change the user's login directory to the user's root directory
chroot_local_user=YES

Line 123.  # Users will not be able to access outside the login directory
chroot_list_enable=YES

Line 125.  # Users listed in vsftpd.chroot_list are exempt from the above restrictions
chroot_list_file=/etc/vsftpd.chroot_list

Line 131.  #Comments Unsubscribe( Enable batch transfer by directory)
ls_recurse_enable=YES

④vsftpd.chroot_listの作成

# vi /etc/vsftpd.chroot_list
# Fill in only the user name (huong) in the new file and finish saving.
huong

⑤Restart vsftpd

# systemctl restart vsftpd

⑥Check with FTP client
In this case, FileZilla will be used.
Open the ftp port with firewall before connecting

# firewall-cmd --permanent --add-service=ftp
# firewall-cmd –reload
Start FileZilla and change FileZilla settings first, menu "Edit" "Settings
"Connection" and "SFTP" in the left pane
Click "Add key File" in the right pane
Open "id_rsa.ppk" saved in Windows
Click "OK
In the "Password" field, enter the password you set when you created your SSH public key.
Return to the initial screen and select "Site Manager" from the "File" menu.

Click on "New site"
Protocol : SFTP-SSH File Transfer Protocol
Host : Server IP Address
Port : SSH port number
Logon Type : Ask for password
User : Logged-in user name
Click "Connect"

Password : Password for logged-in user

If the Windows directory appears on the left and the Ubuntu directory on the right, the connection is successful.

タイトルとURLをコピーしました