ubuntuの下でFTPサーバーを構築する
最近からwordpressで自分のブログを作り始め、wordpressを自動的に更新する際にFTPサービスを利用し、Ubuntuのクラウドホスト上にFTPを配置するのに時間がかかったので、ここでまとめてみます.
FTPを構築するには、有名なvsftpdを使うに違いない.具体的な手順は次のとおりです.インストールvsftpd 構成vsftpdパラメータプロファイルは/etc/vsftpd.confであり、まず元のプロファイルをバックアップします. 上記が完了したら、 加入者 上記の手順のみを実行すると、wordpressでftp更新を使用すると、新規ユーザーにwordpressが存在するディレクトリの変更権限がないため、ユーザーの権限を変更する必要があるため、ディレクトリを作成できないエラーが発生します.(ここwordpressのディレクトリは vsftpdサービス
参考資料
vsftpdインストールFTPユーザーディレクトリ権限構成
FTPを構築するには、有名なvsftpdを使うに違いない.具体的な手順は次のとおりです.
apt-get install vsftpd
cp /etc/vsftpd.conf /etc/vsftpd.conf.old
その後、パラメータを変更します.# Example config file /etc/vsftpd.conf
listen=YES
anonymous_enable=NO #
local_enable=YES #
write_enable=YES # , ,
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES #
use_localtime=YES #
xferlog_enable=YES #
xferlog_file=/var/log/vsftpd.log #
xferlog_std_format=YES #
chroot_local_user=YES # home
chroot_list_enable=YES # chroot
chroot_list_file=/etc/vsftpd.chroot_list # chroot
ls_recurse_enable=YES #
secure_chroot_dir=/var/run/vsftpd/empty #
chroot_についてlocal_user,chroot_list_enable,chroot_list_flieの3つのパラメータは、以下のように説明されています.# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#
# 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
オプションがNO
であれば、ローカルアカウントはホームディレクトリ以外の他のディレクトリにアクセスすることができ、このときchroot_list_file
はchroot()
ができないユーザである.chroot_local_user
がYES
である場合、ローカルアカウントは自分のディレクトリにしかアクセスできず、chroot_list_file
はchroot()
可能なユーザーリストとなる./etc/shells
ファイルを編集し、/sbin/nologin
がなければ、この行を追加します./sbin/nologin
useradd -g ftp -d /home/username -m username
#-g
#-d
#-m
passwd username #
/var/www/html/wordpress
)chmod -R 755 /var/www/html/wordpress
chown -R username:ftp /www/html/wordpress
service vsftpd restart
を再起動するとftpを使用してwordpressの更新を行うことができ、新しい翻訳、テーマ、プラグインをインストールすることもできます.参考資料
vsftpdインストールFTPユーザーディレクトリ権限構成