ftp的常用配置文件参数
这篇文章主要介绍“ftp的常用配置文件参数”,在日常操作中,相信很多人在ftp的常用配置文件参数问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ftp的常用配置文件参数”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
创新互联建站自2013年创立以来,先为蒙城等服务建站,蒙城等地企业,进行企业商务咨询服务。为蒙城企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
ftp用户:
系统用户
匿名用户---->系统用户
虚拟用户---->系统用户
ftp用户的默认访问目录:
匿名用户访问目录:/var/ftp
系统用户的访问目录:用户的家目录
安全通信方式
ftps: ftp+ssl/tls
sftp: OpenSSH,SubSystem,sftp(SSH)
1 安装软件
[root@CnBJYwz01QNmoSmokepingL01 ~]# yum -y install vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.btte.net * epel: mirrors.aliyun.com * extras: mirrors.btte.net * updates: mirrors.btte.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0:2.2.2-21.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================== Installing: vsftpd x86_64 2.2.2-21.el6 base 155 k Transaction Summary ============================================================================================================================================================================== Install 1 Package(s) Total download size: 155 k Installed size: 340 k Downloading Packages: vsftpd-2.2.2-21.el6.x86_64.rpm | 155 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : vsftpd-2.2.2-21.el6.x86_64 1/1 Verifying : vsftpd-2.2.2-21.el6.x86_64 1/1 Installed: vsftpd.x86_64 0:2.2.2-21.el6 Complete! [root@CnBJYwz01QNmoSmokepingL01 ~]# rpm -ql vsftpd /etc/logrotate.d/vsftpd /etc/pam.d/vsftpd /etc/rc.d/init.d/vsftpd /etc/vsftpd /etc/vsftpd/ftpusers /etc/vsftpd/user_list /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd_conf_migrate.sh /usr/sbin/vsftpd /usr/share/doc/vsftpd-2.2.2 ....... /var/ftp //ftp服务的根目录 /var/ftp/pub |
2 启动服务
[root@CnBJYwz01QNmoSmokepingL01 ~]# /etc/init.d/vsftpd start Starting vsftpd for vsftpd: [ OK ] [root@CnBJYwz01QNmoSmokepingL01 ~]# chkconfig vsftpd on [root@CnBJYwz01QNmoSmokepingL01 ~]# |
3 测试登陆
匿名登陆ftp服务器 localhost:~ ray$ ftp 192.168.2.141 Connected to 192.168.2.141. 220 (vsFTPd 2.2.2) Name (192.168.2.141:ray): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ftp> help Commands may be abbreviated. Commands are: ! features mls prompt site $ fget mlsd proxy size account form mlst put sndbuf append ftp mode pwd status ascii gate modtime quit struct bell get more quote sunique binary glob mput rate system bye hash mreget rcvbuf tenex case help msend recv throttle cd idle newer reget trace cdup image nlist remopts type chmod lcd nmap rename umask close less ntrans reset unset cr lpage open restart usage debug lpwd page rhelp user delete ls passive rmdir verbose dir macdef pdir rstatus xferbuf disconnect mdelete pls runique ? edit mdir pmlsd send epsv4 mget preserve sendport exit mkdir progress set ftp> 系统用户登陆 [localhost:~ ray$ ftp 192.168.2.142 Connected to 192.168.2.142. 220 (vsFTPd 2.2.2) Name (192.168.2.142:ray): ray 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ftp> ftp> ls 229 Entering Extended Passive Mode (|||59706|). 150 Here comes the directory listing. 226 Directory send OK. ftp> ftp> pwd Remote directory: /home/ray ftp> |
4 常用配置文件参数
# Allow anonymous FTP? (Beware - allowed by default if you comment this out). anonymous_enable=YES #是否允许匿名用户登陆 # Uncomment this to allow local users to log in. local_enable=YES #是否允许本地的系统用户登陆 # Uncomment this to enable any form of FTP write command. write_enable=YES #是否允许上传文件 anon_upload_enable=YES #是否允许匿名用户上传文件,打开上传权限。注意:最终文件能否上传成功,取决于文件系统权限和文件共享权限 anon_mkdir_write_enable=YES #是否允许匿名用户创建目录 anon_other_write_enable=YES #是否允许匿名用户其他写动作,如:删除和修改 # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES #当用进入目录,是否显示欢迎信息 # The target log file can be vsftpd_log_file or xferlog_file. # This depends on setting xferlog_std_format parameter xferlog_enable=YES #是否打开传输日志,记录上传下载的操作命令 # The name of log file when xferlog_enable=YES and xferlog_std_format=YES # WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log xferlog_file=/var/log/xferlog #指定传输日志的路径 # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #是否允许上传文件完,修改用户属组 #chown_username=whoever #文件上传完,修改成用户属性 # You may change the default value for timing out an idle session. #idle_session_timeout=600 #超时时间,控制连接 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 #超时时间,数据连接 # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). #chroot_local_user=YES #是否将所有用户限制在主目录,YES为启用 NO禁用.(该项默认值是NO,即在安装vsftpd后不做配置的话,ftp用户是可以向上切换到要目录之外的) #chroot_list_enable=YES #是否允许启用限制用户名单 # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list #禁锢用户列表,文件需要主动创建 # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=YES #是否为独立守护进程 userlist_enable=YES #是否启用/etc/vsftpd/user_list名单 userlist_deny=YES #yes表示/etc/vsftpd/user_list为黑名单,no为白名单, #If vsftpd is in standalone mode, this is the maximum number of clients which may be connected. Any additional clients connecting will get an error message. The value 0 switches off the limit. max_clients #限制最大客户端数量 #If vsftpd is in standalone mode, this is the maximum number of clients which may be connected from the same source internet address. A client will get an error message if they go over this limit. The value 0 switches off the limit. max_per_ip #限制相同IP的连接客户端数量 |
对于ftp用户访问ftp服务时应该对其chroot
禁锢用户于其家目录中
chroot_local_user={Yes|No}
chroot_list_enable={YES|NO}
chroot_list_file=/etc/vsftpd/chroot_list
每行一个用户
匿名用户的配置:
anonymous_enable=YES
anon_upload_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
注意:启用写入功能时,ftp用户对相应的本地文件系统也有相应的写入权限;
生效的权限取决于文件系统权限和服务权限的交集;
欢迎信息的定义:
banner_file=/path/to/some_banner_file
ftp_banner=some string
dirmessage_enable=yes
在某ftp可访问的目录下创建.messages文件
vsftp控制登录用户的机制:
/etc/vsftpd/ftpusers中的用户都不允许使用ftp服务, 这是在/etc/pam.d/vsftpd中定义;
user_list配置文件有两种用法:
黑名单:
userlist_enable=YES
userlist_deny=YES
白名单
userlist_enable=YES
userlist_deny=NO
连接限制:
max_clients: 最大并发连接数
max_per_ip: 每IP可同时发起并发请求
传输速率:
anon_max_rate: 匿名用户的最大传输速率,单位是“字节/秒”;
local_max_rate: 本地用户……………………
上传文件的umask:
anno_umask: 匿名用户上传文件的umask;
local_umask:
修改匿名用户上传文件的属主和属组:
chown_uploads=YES
chown_username=someuser
虚拟用户:
所有的虚拟用户会映射会一个系统用户,访问时的文件目录是为此系统用户的家目录;
虚拟用户:
hash编码的文件:
奇数行为用户名,偶数行为密码
关系型数据库:
pam-MySQL实现认证
到此,关于“ftp的常用配置文件参数”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
分享标题:ftp的常用配置文件参数
文章出自:http://azwzsj.com/article/gopdho.html