Help us understand the problem. What is going on with this article?

EC2をFTPS化する方法

EC2をFTPS化する方法

色んなサイトを見ても純粋にEC2をFTPS化する記事がなくてめちゃくちゃハマったのでメモ

使用した物

  • Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
  • FileZilla

やり方

サーバー設定

  • インスタンスの立ち上げ

    セキュリティグループの設定例
    SnapCrab_NoName_2016-4-25_23-4-43_No-00.png

  • sshで接続

    ssh -i Downloads/demo.pem ubuntu@<IPアドレス>
    
  • Ubuntuを更新

    sudo apt update
    sudo apt upgrade
    
  • vsftpdをインストール

    sudo apt install vsftpd
    
  • vsftpdを使ってFTPSをスタートさせるにはrootユーザーである必要があるのでユーザー変更

    sudo -i
    
  • rootユーザーのパスワードを設定

    passwd root
    
  • Certificateを保存すディレクトリの作成

    mkdir /etc/ssl
    
  • Certificateの作成

    openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/vsftpd.pem -out /etc/ssl/vsftpd.pem
    
  • vsftpd.confの編集(FTPS化)

    vim /etc/vsftpd.conf
    
    # 以下の設定を追加
    rsa_cert_file=/etc/ssl/vsftpd.pem
    rsa_private_key_file=/etc/ssl/vsftpd.pem
    ssl_enable=YES
    allow_anon_ssl=NO
    force_local_data_ssl=YES
    force_local_logins_ssl=YES
    ssl_tlsv1=YES
    ssl_sslv2=NO
    ssl_sslv3=NO
    require_ssl_reuse=NO
    ssl_ciphers=HIGH
    pasv_enable=Yes
    pasv_min_port=60000
    pasv_max_port=60030
    pasv_address=<EC2で作成したIPv4 Public IP>
    
  • rootでログインできる様にファイルを変更

    vim /etc/ftpusers
    #この中のrootをコメントアウト
    

    Screen Shot 2020-04-22 at 6.07.45 PM.png

  • サービス開始

    systemctl restart vsftpd
    systemctl status vsftpd
    

FileZilla

Screen Shot 2020-04-22 at 6.10.28 PM.png

Tips

  • vsftpd.confの内容が合っているか確認する方法

    /usr/sbin/vsftpd /etc/vsftpd.conf
    
  • もしこのエラーがでたら

    500 OOPS: config file not owned by correct user, or not a file
    # このコマンドでオーナーを変える
    chown root:root /etc/vsftpd.conf
    

参考URL

https://www.youtube.com/watch?v=VZm8SoxgwXc
https://www.getpagespeed.com/server-setup/ssl-directory
https://dev.classmethod.jp/articles/ftps_on_centos7/
https://www.serverkaka.com/2018/08/enable-password-authentication-aws-ec2-instance.html

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした