ITわかり隊

会社のホームページにソフトやデータをダウンロード(Vsftpd)

1 views

実現する機能

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

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

■実現する機能自宅にインターネットとパソコンがあったので、資金0円で起業できるか奮闘中。このサイトは有料のレンタルサーバー、ロリポップ!で運営している。CentOS7で作成Windows10で作成MyDNSで取得ieServer.Netで取得Nginxで構築Let’s Encryptで取得会社のホームページをWordPressで作成(php)会社のホームページをWordPressで作成(Mariadb)会社のホームページをWordPressで作成(vsftpd)会社のホームページをWordPressで作成(WordPress)内外の営業に不可欠なメールサーバー構築自社専用のメールソフト構築大事な顧客デー...
自宅サーバーで起業する(CentOS 8 ) - ufuso.jp/wp

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で取得済み

実現する機能怪しいサイト扱いされないために、サーバにSSLサーバ証明書を導入します。SSLサーバ証明書は、信頼のおける第三者機関=認証局が発行する電子的な証明書で、ウェブサイトを安全に利用するための3つの機能、身元保証、通信データの暗号化、通信データの漏えい検出機能が備わっています。有料のものは数万円しますが、今回はLet's Encrypt から 発行料 無料の SSL/TLS サーバー証明書を取得しました。以下は、その備忘録です。事前準備GNOME端末でviコマンドを使う方法を理解しておくこと。以下の記述ではGNOME端末を表...
怪しいサイト扱いされないためにサーバー証明書の取得 - ufuso.jp/wp

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

以上

モバイルバージョンを終了