業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

AlmaLinux9.7 : FTP Server , Samba File Server

1.FTP Server

1. 1 vsftpd Install

1.2 Vsftpd Configuration

Back up the vsftpd.conf file before editing

Editing Configuration Files

Edited content

●Lines 82 and 83: Uncomment (Allow ASCII mode transfer)
ascii_upload_enable=YES
ascii_download_enable=YES
●Lines 100, 101: Uncomment (chroot enabled)
chroot_local_user=YES
chroot_list_enable=YES
●Line 103: Uncomment (chroot list file specification)
chroot_list_file=/etc/vsftpd/chroot_list
●Line 109: Uncomment (Enable bulk transfer of entire directories)
ls_recurse_enable=YES
●Line 114 Change (Enable IPv4)
listen=YES
●Line 123 Change (Ignore IPv6)
listen_ipv6=NO

#Add to the last line
#Use local time
use_localtime=YES

②Add users to allow directory access to upper level
In my case, I wrote huong.

③Specify IP addresses to allow connections in /etc/hosts.allow
192.168.11.0/24 is configured to allow all local IP addresses in my environment.

Write vsftpd:ALL (deny all connections) in /etc/hosts.deny

This setting overrides hosts.allow. That is, everything is denied, and IP addresses specified in hosts.allow are allowed.

④Enable vsftpd autostart and start it

⑤From windows side, check if you can connect with FileZilla.
Open the ftp port with firewall before connecting

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 : Server IP Address
Port : can be left blank
Encryption : Use expllict FTP ocver TLS if available
Logon Type : Ask for password
User  : General user name (server login user)

Set the password for the login user in "Password" and click "OK".

Click "OK" when the following screen appears

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

2. Vsftpd SSL/TLS

Configure Vsftpd to use SSL/TLS

2.1 Create self-signed certificates

This work is not required if you are using a trusted, legitimate certificate such as Let's Encrypt.

2.2 Vsftpd Configuration

Edited content

● Add to the last line: Enable SSL/TLS
rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem
ssl_enable=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES

If Firewalld is enabled, allow passive ports.
●Add to the last line
# Set passive ports to any range of ports
pasv_enable=YES
pasv_min_port=60000
pasv_max_port=60100

Allow passive ports in Firewalld

When connecting to FileZilla, the following screen appears, check the box and click "OK" to connect as described above.

3. File server installation with Samba

Build a file server with access rights that requires user authentication with Samba.
Installation Procedure
①Create shared folders with access rights that require user authentication
②Accessible group creation
③Creation of users belonging to accessible groups
④Configuration File Editing

3.1 samba Install

3.2 Create a shared folder (smbshare)

3.3 Accessible group (smbgroup) creation

3.4 Configuration File Edit

Edited content

Lines 11-12:
unix charset = UTF-8 # Addendum
dos charset = CP932 # Addendum
workgroup = SAMBA
security = user
# Addendum (Restrict access to internal users only)
hosts allow = 127. 192.168.11.

#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 for file creation to [smbgroup]
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

3.5 Samba Restart

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

3.7 Firewalld allows Samba services

3.8 Accessing shared directories from Windows 11

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

Enter 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"

Shared directory information is displayed.

Copied title and URL