Again to the final exam, this year when the data mining assistant, the course has a programming big job, need to set up an FTP server, to achieve file upload, but prohibit under the load name.
Server system is ubuntu12.04 server, using the FTP server is also the Linux under the famous VSFTPD, configured as follows:
1 Create user DM, set its login terminal to/bin/false, prevent user SSH login
1
|
useradd -m -s / bin/ false  DM |
2 Add/bin/false to/etc/shells so that it can use DM users for FTP login
1
|
echo "/bin/bash " >>/ etc/ shells |
3 Configure vsftpd.conf, prohibit users to access the upper directory. Create/etc/vsftpd.chroot_list, do not add any users, in Vsftpd.chroot_list can switch to the upper directory, we need to prohibit DM users here. The main configuration is as follows:
1 2 3
|
Chroot_local_user=yes chroot_list_enable=yes Chroot_list_file=/etc/Vsftpd.chroot_list |
4 Add appropriate permissions to prevent users from under load naming
With the cmds_allows command configuration, the disallowed commands (rename, download, delete, create folder) are removed:
1 |
cmds_allowed=feat,rest,cwd,list,mdtm,nlst,pass,pasv,port,pwd,quit,rmd,size,stor,type,user, Acct,appe,cdup,help,mode,noop,rein,stat,stou,stru,syst |
The main commands are explained as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21st 22 23 24 25 26 27 28 29 30 31 32
|
===================== most commonly used, out of the corresponding command can be ======================== Mkd-make a remote directory new folder Nlst-name List of remote directory Pwd-print working directory displays the current working directory Retr-retrieve a remote file download file Stor-store a file on the remote host uploads files Dele-delete A remote file delete files Rmd-remove A remote directory delete directories Rnfr-rename from Rename Rnto-rename to rename ==================================================================== Abor-abort a file transfer canceling the transfer of files Cwd-change Working Directory Change directories Dele-delete A remote file delete files List-list Remote Files Column directory Mdtm-return The modification time of a file returns the update times for files Mkd-make a remote directory new folder Nlst-name List of remote directory Pass-send Password Pasv-enter Passive Mode Port-open A data port opens a transport port Pwd-print working directory displays the current working directory Quit-terminate the connection exit Retr-retrieve a remote file download file Rmd-remove a remote directory Rnfr-rename from Rnto-rename to Site-site-specific commands Size-return the size of a file returns the FileSize Stor-store a file on the remote host uploads files Type-set Transfer Type User-send username |
For
more articles, go toXiao Fat Xuan
.
Configure the FTP server to upload only can not do other operations