1 views

実現する機能

ホームページにWordPressを使っていて、FTPサーバーがなければテーマやプラグインのインストールやアップデートができないため、Vsftpdを導入して、インストールやアップデートができるようにしました。SSLでID&パスワードの暗号化通信ができたりするのでVPSでも安心です。

事前準備(下記サイトで確認のこと)

Vsftpdの導入手順

GNOME端末でviコマンドを使う方法を理解しておくこと。以下の記述ではGNOME端末で表示された内容を表示しています。紫色はキーボードから入力するコマンド(コピペした方が楽ですが、コマンドは覚えられません)、緑はコマンドや処理内容の説明、白は自動表示する部分、赤は注意書きです。

(1)Vsftpdのインストール

#vsftpdのインストール
[root@eycwl8s4 ~]# dnf -y install vsftpd
インストール済み:
vsftpd-3.0.3-34.el8.x86_64

完了しました!

(2)Vsftpdの設定

#Vsftpdファイルの設定
[root@eycwl8s4 ~]# vi /etc/vsftpd/vsftpd.conf


# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command “SIZE /big/file” in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#行頭の#を削除して、アスキーモードでのアップロードを許可
ascii_upload_enable=YES
#行頭の#を削除して、アスキーモードでのダウンロードを許可
ascii_download_enable=YES

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot’ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#行頭の#を削除して、ディレクトリより上層へ行けるユーザーを制限
chroot_local_user=YES
#行頭の#を削除して、ディレクトリより上層へ行けるユーザーリスト使用
chroot_list_enable=YES
# (default follows)
#行頭の#を削除して、許可ユーザーのリストファイル指定
chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the “-R” option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as “ncftp” and “mirror” assume
# the presence of the “-R” option, so there is a strong case for enabling it.
#行頭の#を削除して、ディレクトリ単位での一括転送を許可
ls_recurse_enable=YES
#
# When “listen” directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
#listen=NO
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 “any” address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
listen_ipv6=NO

pam_service_name=vsftpd
userlist_enable=YES

#追記して、タイムスタンプに日本時間を使う
se_localtime=YES

#上層アクセスユーザーリストの作成
[root@eycwl8s4 ~]# vi /etc/vsftpd/chroot_list
#上層アクセスユーザーに自分のユーザー名(tuは例示)のみ登録
tu

#Vsftpdの起動と自動起動設定

[root@eycwl8s4 ~]# systemctl enable --now vsftpd

Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.

(3)SSL/TSLの設定

Let’s Encryptで取得済み

#SELinuxが有効な場合には、フルアクセス許可を設定
[root@eycwl8s4 ~]# setsebool -P allow_ftpd_full_access 1

以上

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください