GNU/Linux >> Linux の 問題 >  >> Cent OS

Vsftpd サービスで FTP コマンドを制限/制限する方法 (CentOS/RHEL 6、7)

ユーザーが vsftpd サービスで実行できる ftp コマンドを制限または制限する方法を学びます。たとえば、ユーザーによるディレクトリの作成または削除を拒否する方法などです。

1. vsftpd サービスがインストールされ、デフォルトのオプションで構成されます。ディレクトリの作成と削除は期待どおりに機能しています。

# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 3.0.2)
Name (localhost:root): test
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>ftp> mkdir test
257 "/home/test/test" created
ftp> rmdir test
250 Remove directory operation successful.
ftp>

2. ディレクトリの作成または削除を拒否されたユーザー。ファイル /etc/vsftpd/vsftpd.conf の末尾に以下の行を追加します。 .

# tail /etc/vsftpd/vsftpd.conf
tcp_wrappers=YES

# Allowed commands
#cmds_allowed=ABOR,ACCT,ALLO,APPE,CDUP,CWD,DELE,EPRT,EPSV,FEAT,HELP,LIST,MDTM,MODE,NLST,NOOP,OPTS,PASS,PASV,PORT,PWD,QUIT,REIN,REST,RETR,RMD,RNFR,RNTO,SITE,SIZE,SMNT,STAT,STOR,STOU,STRU,SYST,TYPE,USER,XCUP,XCWD,XPWD,XRMD

# Explicitly denied commands
cmds_denied=RMD,RMDIR,XRMD,MKD,MKDIR,XMKD

3. vsftpd サービスを再起動します

# systemctl restart vsftpd

注:Oracle Linux 6 の場合、

を使用します。
# service vsftpd restart

4. ユーザーはディレクトリを作成または削除できません:

# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 3.0.2)
Name (localhost:root): test
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
ftp> mkdir test2
550 Permission denied.   
ftp>
ftp> rmdir test
550 Permission denied.   
ftp>

詳細については、man ページを参照してください:

# man vsftpd.conf

cmds_allowed
This option specifies a comma-separated list of allowed FTP commands (post login. USER, PASS and QUIT and
others are always allowed pre-login). Other commands are rejected. This is a powerful method of really
locking down an FTP server. Example: cmds_allowed=PASV,RETR,QUIT

Default: (none)

cmds_denied
This option specifies a comma-separated list of denied FTP commands (post login. USER, PASS, QUIT and
others are always allowed pre-login). If a command appears on both this and cmds_allowed then the denial
takes precedence. (Added in v2.1.0).


Cent OS
  1. CentOS / RHEL 7 :ftp サーバー (vsftpd) をインストールして構成する方法

  2. CentOS / RHEL :すべての LVM コマンドをログに記録する方法

  3. CentOS/RHEL 5 および 6 で FTP を有効にする方法

  1. VSFTPDを使用してCentOS7にFTPサーバーをインストールする方法

  2. CentOS / RHEL 4 :FTP サーバー (vsftpd) をインストールして構成する方法

  3. CentOS/RHEL 8 でネットワーク サービスを再起動する方法

  1. RHEL 8 /CentOS8にphpMyAdminをインストールする方法

  2. RHEL 8 /CentOS8にP7Zipをインストールする方法

  3. RHEL 8 /CentOS8にntfs-3gをインストールする方法