Ubuntu Server26.10 :  FTP(Vsftpd) , Samba Install

FTP Server

1. Vsftpd Installation and configuration

①Install

# apt -y install vsftpd

②Allow PORT 21 at UFW

# ufw allow ftp
# ufw reload

③Configuration File Changes

# vi /etc/vsftpd.conf

Line 14 : Change
Listen=YES

Line 22 : Change
Listen_ipv6=NO

Line 31 : Uncomments
write_enable=YES

Line 35 : Uncomments
local_umask=022

Line 99-100 : Uncomments(Allow uploads and downloads via ASCII)
ascii_upload_enable=YES
ascii_download_enable=YES

Line 122 : Uncomments
chroot_local_user=YES

Line 123 : Uncomments
chroot_list_enable=YES

Line 125 : Uncomments
chroot_list_file=/etc/vsftpd.chroot_list

Line 131 : Uncomments(Enable bulk transfer of entire directories)
ls_recurse_enable=YES

④Creating vsftpd.chroot_list

④Creating 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 start vsftpd

# systemctl enable vsftpd

Start FileZilla and select "Site Manager" from the "File" menu.

Click on "New site"

Enter the following settings for each item and click "Connect"
Protocol : FTP- File Transfer Protocol
Host : IP address of the server
Port :
Logon Ask for password
User  : General user name (server login user)

Password : logd in user password

If the connection is successful, the server directory is displayed on the right and the Windows directory on the left.

2. Vsftpd Over SSL/TLS

①Create a self-signed certificate.
If you are using a trusted, legitimate certificate such as Let's Encrypt, you do not need to do this work.

# cd /etc/ssl/private
# openssl req -x509 -nodes -newkey rsa:3072 -keyout vsftpd.pem -out vsftpd.pem -days 3650

---------------------------------------------------------------------------
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Osaka
Locality Name (eg, city) []:Sakai
Organization Name (eg, company) [Internet Widgits Pty Ltd]:private
Organizational Unit Name (eg, section) []:Admin
Common Name (e.g. server FQDN or YOUR name) []:Lepard
Email Address []:[管理者アドレス]

➁Edit Vsftpd configuration file

# vi /etc/vsftpd.conf

Line 149,150: comment out
#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

Line 151 : Change
ssl_enable=YES

Add the following after line 152:
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_ciphers=HIGH
force_local_data_ssl=YES
force_local_logins_ssl=YES

Restart Vsftpd

# systemctl restart vsftpd

Start FileZilla and check
As before, select "Site Manager" from the "File" menu, select the appropriate server, click "Connect," and the following screen will appear.

File server installation with Samba

Build a file server with access rights that requires user authentication with Samba.
Installation Procedure
(1) Create a shared folder with access rights that requires user authentication.
(2) Create a group with access rights
(3)Create users belonging to groups that can be accessed
(4)Edit configuration file

① samba install

#  apt -y install samba

➁ Create a shared folder (smbshare)

# mkdir /home/smbshare

➂ Create accessible group (smbgroup)

# groupadd smbgroup
# chgrp smbgroup /home/smbshare
# chmod 770 /home/smbshare

④ Configuration File Edit

# vi /etc/samba/smb.conf

Line 25 :
[global]
unix charset = UTF-8 # Add
dos charset = CP932 # Add

Line 41 : Add networks to allow access
interfaces = 127.0.0.0/8 192.168.11.0/24 ens33

Line 106 : Comment out and add below
#map to guest = bad user
security = user

Add to the last line
Set any shared name
[Smbshare]
# Specify a shared folder
path = /home/smbshare
# Allow posting
writable = yes
# Do not allow guest users
guest ok = no
# [smbgroup] Allow access only to the group
valid users = @smbgroup
# Set the group to [smbgroup] when creating files
force group = smbgroup
# Set the permissions to [770] when creating the file.
force create mode = 770
# Set the permissions to [770] when creating folders.
force directory mode = 770
# Inherit permissions from the parent folder
inherit permissions = yes

⑤ SMB start

# systemctl enable smbd
# systemctl start smbd

⑥ User (smbuser) registration, password setting, group registration

# useradd smbuser
# smbpasswd -a smbuser
New SMB password:     #  Password Setup
Retype new SMB password:
Added user smbuser.

smbuserをsmbgroupにする
# usermod -aG smbgroup smbuser

⑦ UFW to allow Samba services

# ufw allow samba 
# ufw reload

⑧ Accessing shared directories from Windows 11

Connect from Windows Explorer
Open Explorer and enter "\\server IP" (in this case 192.168.11.83) in the address field.
Access the server.

You will be asked to enter your authentication information.
User name : User name created in "3.6 User (smbuser) Registration, Password Setting, Group Registration"
Password : Password for the above user
Click "OK"

Confirm that files and folders are newly created when the shared directory information is displayed.