LoginSignup
10

More than 5 years have passed since last update.

さくらVPS(Ubuntu16.04)でFTPを使えるようにする

Last updated at Posted at 2016-08-30

背景

さくらVPS契約後、CentOSがデフォルトで入っていますが、自身の作業では、Ubuntuの方が良いためUbuntuに入れ替えました。

CentOSでFTPを設定する以下の投稿はありましたが、
http://qiita.com/satomyumi/items/11382273624621f3caee
Ubuntuは見つからなかったので備忘録としてまとめます。

環境

OS: Ubuntu16.04 (さくらVPS)

実行手順

①vftpdをインストール

以下のコマンドを実行する

sudo apt-get install vsftpd -y

②configファイルを編集する

vim /etc/vsftpd.conf

▼25行目:匿名ユーザのアクセスを拒否する
anonymous_enable=NO

▼31行目:ファイルシステムを変更するFTPコマンドを許可する
write_enable=YES

▼99行目:アスキーモードのアップロードを許可する
ascii_upload_enable=YES

▼100行目:アスキーモードのダウンロードを許可する
ascii_download_enable=YES

▼120行目:設定したディレクトリより上層への移動を禁止する
chroot_local_user=YES

▼121行目:YESの場合、リストアップされたユーザはchrootの対象から除外される
chroot_list_enable=YES

▼125行目:リストアップのファイルの場所を指定する
chroot_list_file=/etc/vsftpd.chroot_list

▼131行目:サブフォルダを含む一括アップロード・ダウンロードを出来るようにする
ls_recurse_enable=YES

▼最終行:ルートディレクトリを指定する
local_root = <path_to_root>

※指定しない場合はユーザーのホームディレクトリ直下にななります。
※public_htmlを指定した場合で、且つ当該ディレクトリがないとログインできないので注意

▼seccomp filter をオフを追記する
seccomp_sandbox=NO

③アクセス許可をするユーザを設定する

vim /etc/vsftpd.chroot_list

上記のコマンドで、vsftpd.chroot_listを新規作成し、
1行目にアクセスするユーザの名前を入力する。

④vsftpdを再起動する

sudo service vsftpd restart

⑤動作確認

「telnet localhost 21」とコマンドを入力し、以下のような表示になれば正常に動作しています。

Trying ::1...
 >Trying 127.0.0.1
 >Connected to localhost
 >Escape character is '^]'.
 >220 (vsFTPd 3.0.2)

その後、外部のFTPクライアントを使用して、
アクセスを試みてください。

※より具体的な内容を知りたい場合は、以下の参考URLをご参照ください。
http://www.server-world.info/query?os=Ubuntu_14.04&p=ftp
http://www.ehowstuff.com/how-to-install-and-configure-vsftpd-ftp-server-on-ubuntu-14-04/

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10