ユーザーが 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).
「警告:VG 名 [vgname] が重複しています」 – LVM コマンドの実行中にエラーが発生しました
NFSv4 マウントポイントは、CentOS/RHEL で nobody:nobody として誤った所有権を表示します