【Linux】FTPサーバ vsftpd を構築する

■ はじめに

Linux(openSUSE)で、FTPサーバを構築する

目次

【1】構築環境
【2】手順
 1)vsftpdのインストール
 2)vsftpdの設定
 3)vsftpd.confの設定
 4)FTPのアクセス制限の設定および解除
 5)vsftpdの起動

【1】構築環境

* OS(Linux) : openSUSE13.1
* FTPサーバ : vsftpd

【2】手順

1)vsftpdのインストール

[1] ターミナルを起動し、以下のコマンドを入力する

zypper install -y vsftpd

コマンド出力例

linux-cgjs:~ # zypper install -y vsftpd
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  vsftpd 

1 new package to install.
Overall download size: 141.7 KiB. After the operation, additional 327.3 KiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package vsftpd-3.0.2-10.1.2.x86_64                  (1/1), 141.7 KiB (327.3 KiB unpacked)
Retrieving: vsftpd-3.0.2-10.1.2.x86_64.rpm .....................................[done (129.0 KiB/s)]
(1/1) Installing: vsftpd-3.0.2-10.1.2 ........................................................[done]

2)vsftpdの設定

[1] /etc/xinetd.d/vsftpd を編集する

vi /etc/xinetd.d/vsftpd

編集内容

# (1) 書き込み許可(yes => noに変更)
        disable                 = no

3)vsftpd.confの設定

[1] /etc/vsftpd.conf を編集する

vi /etc/vsftpd.conf

編集内容

# (1) 書き込み許可(NO => YESに変更)
write_enable=YES

# (2) 1行のバナー表示(コメントアウトおよび内容変更)。任意。又、実環境では設定しない方がいいかも。
ftpd_banner=Welcome to Sample FTP service.

# (3) ディレクトリごと一括転送有効(コメントアウト)
ls_recurse_enable=YES

# (4) 匿名ログイン禁止(YES => NOに変更)
anonymous_enable=NO

# (5) アスキーモード転送許可(コメントアウト)
ascii_upload_enable=YES
ascii_download_enable=YES

# (6) ローカルタイムを使う(最終行へ追記)
use_localtime=YES

4)FTPのアクセス制限の設定および解除

* /etc/ftpusersでFTPのアクセス制限をかけることができ、
 この中にユーザ名が記述されている場合、
 そのユーザは、例え、認証に成功(UserName/Passwordが一致)
 してもアクセスを拒否される

[1] /etc/ftpusers を編集する(必要時のみ)

vi /etc/ftpusers

編集内容

* 例えば、「root」ユーザを使用する場合

【修正前】
postgres
root
sapdb

【修正後】
postgres
#root # Comment out
sapdb

5)vsftpdの起動

[1] ターミナルを起動し、以下のコマンドを入力する

/sbin/service vsftpd start

chkconfig vsftpd on

参考文献

http://www.server-world.info/query?os=SUSE_Linux_Enterprise_Server_11&p=ftp

関連記事

Transfer Family ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2023/01/20/005526