centos6.8下配置vsftp(代码片段)

cfas cfas     2022-12-23     374

关键词:

一、安装VSFTP

 

# yum -y install vsftpd

注意提升权限:

 

 

#su root


二、配置vsftpd.conf 文件

 

 

  1.  
    [[email protected] ~]# vi /etc/vsftpd/vsftpd.conf
  2.  
     
  3.  
    # Example config file /etc/vsftpd/vsftpd.conf
  4.  
    #
  5.  
    # The default compiled in settings are fairly paranoid. This sample file
  6.  
    # loosens things up a bit, to make the ftp daemon more usable.
  7.  
    # Please see vsftpd.conf.5 for all compiled in defaults.
  8.  
    #
  9.  
    # READ THIS: This example file is NOT an exhaustive list of vsftpd options.
  10.  
    # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd‘s
  11.  
    # capabilities.
  12.  
    #
  13.  
    # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
  14.  
    #anonymous_enable=YES
  15.  
    #
  16.  
    # Uncomment this to allow local users to log in.
  17.  
    local_enable=YES
  18.  
    #
  19.  
    # Uncomment this to enable any form of FTP write command.
  20.  
    write_enable=YES
  21.  
    #
  22.  
    # Default umask for local users is 077. You may wish to change this to 022,
  23.  
    # if your users expect that (022 is used by most other ftpd‘s)
  24.  
    local_umask=022
  25.  
    #
  26.  
    # Uncomment this to allow the anonymous FTP user to upload files. This only
  27.  
    # has an effect if the above global write enable is activated. Also, you will
  28.  
    # obviously need to create a directory writable by the FTP user.
  29.  
    #anon_upload_enable=YES
  30.  
    #
  31.  
    # Uncomment this if you want the anonymous FTP user to be able to create
  32.  
    # new directories.
  33.  
    #anon_mkdir_write_enable=YES
  34.  
    #
  35.  
    # Activate directory messages - messages given to remote users when they
  36.  
    # go into a certain directory.
  37.  
    dirmessage_enable=YES
  38.  
    #
  39.  
    # The target log file can be vsftpd_log_file or xferlog_file.
  40.  
    # This depends on setting xferlog_std_format parameter
  41.  
    xferlog_enable=YES
  42.  
    #
  43.  
    # Make sure PORT transfer connections originate from port 20 (ftp-data).
  44.  
    connect_from_port_20=YES
  45.  
    #
  46.  
    # If you want, you can arrange for uploaded anonymous files to be owned by
  47.  
    # a different user. Note! Using "root" for uploaded files is not
  48.  
    # recommended!
  49.  
    #chown_uploads=YES
  50.  
     
  51.  
    #chown_username=whoever
  52.  
    #
  53.  
    # The name of log file when xferlog_enable=YES and xferlog_std_format=YES
  54.  
    # WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
  55.  
    #xferlog_file=/var/log/xferlog
  56.  
    #
  57.  
    # Switches between logging into vsftpd_log_file and xferlog_file files.
  58.  
    # NO writes to vsftpd_log_file, YES to xferlog_file
  59.  
    xferlog_std_format=YES
  60.  
    #
  61.  
    # You may change the default value for timing out an idle session.
  62.  
    idle_session_timeout=600
  63.  
    #
  64.  
    # You may change the default value for timing out a data connection.
  65.  
    data_connection_timeout=120
  66.  
    # It is recommended that you define on your system a unique user which the
  67.  
    # ftp server can use as a totally isolated and unprivileged user.
  68.  
    #nopriv_user=ftpsecure
  69.  
    #
  70.  
    # Enable this and the server will recognise asynchronous ABOR requests. Not
  71.  
    # recommended for security (the code is non-trivial). Not enabling it,
  72.  
    # however, may confuse older FTP clients.
  73.  
    #async_abor_enable=YES
  74.  
    #
  75.  
    # By default the server will pretend to allow ASCII mode but in fact ignore
  76.  
    # the request. Turn on the below options to have the server actually do ASCII
  77.  
    # mangling on files when in ASCII mode.
  78.  
    # Beware that on some FTP servers, ASCII support allows a denial of service
  79.  
    # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
  80.  
    # predicted this attack and has always been safe, reporting the size of the
  81.  
    # raw file.
  82.  
    # ASCII mangling is a horrible feature of the protocol.
  83.  
    ascii_upload_enable=YES
  84.  
    ascii_download_enable=YES
  85.  
     
  86.  
    #
  87.  
    # You may fully customise the login banner string:
  88.  
    ftpd_banner=Welcome to lightnear FTP service.
  89.  
    #
  90.  
    # You may specify a file of disallowed anonymous e-mail addresses. Apparently
  91.  
    # useful for combatting certain DoS attacks.
  92.  
    #deny_email_enable=YES
  93.  
    # (default follows)
  94.  
    #banned_email_file=/etc/vsftpd/banned_emails
  95.  
    #
  96.  
    # You may specify an explicit list of local users to chroot() to their home
  97.  
    # directory. If chroot_local_user is YES, then this list becomes a list of
  98.  
    # users to NOT chroot().
  99.  
    chroot_local_user=YES
  100.  
    #chroot_list_enable=YES
  101.  
    # (default follows)
  102.  
    #chroot_list_file=/etc/vsftpd/chroot_list
  103.  
    #
  104.  
    # You may activate the "-R" option to the builtin ls. This is disabled by
  105.  
    # default to avoid remote users being able to cause excessive I/O on large
  106.  
    # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
  107.  
    # the presence of the "-R" option, so there is a strong case for enabling it.
  108.  
    ls_recurse_enable=YES
  109.  
    #
  110.  
    # When "listen" directive is enabled, vsftpd runs in standalone mode and
  111.  
    # listens on IPv4 sockets. This directive cannot be used in conjunction
  112.  
    # with the listen_ipv6 directive.
  113.  
    listen=YES
  114.  
    #
  115.  
    # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
  116.  
    # sockets, you must run two copies of vsftpd with two configuration files.
  117.  
    # Make sure, that one of the listen options is commented !!
  118.  
    #listen_ipv6=YES
  119.  
     
  120.  
    pam_service_name=vsftpd
  121.  
    userlist_enable=YES
  122.  
    userlist_deny=NO
  123.  
    local_root=/var/public_root
  124.  
    tcp_wrappers=YES
  125.  
    use_localtime=YES

 

 

三、增加FTP账号

 

  1.  
    [[email protected] ~]# useradd ftpuser -s /sbin/nologin
  2.  
    [[email protected] ~]# passwd ftpuser

ftpuser为账户名,passwd的作用为重设ftpuser的密码。

 

四、编辑user_list文件,允许cent用户访问

# vi /etc/vsftpd/user_list
  1.  
    # vsftpd userlist
  2.  
    # If userlist_deny=NO, only allow users in this file
  3.  
    # If userlist_deny=YES (default), never allow users in this file, and
  4.  
    # do not even prompt for a password.
  5.  
    # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
  6.  
    # for users that are denied.
  7.  
    root
  8.  
    bin
  9.  
    daemon
  10.  
    adm
  11.  
    lp
  12.  
    sync
  13.  
    shutdown
  14.  
    halt
  15.  
    mail
  16.  
    news
  17.  
    uucp
  18.  
    operator
  19.  
    games
  20.  
    nobody
  21.  
    ftpuser


五、建立我们的根目录,并设置访问权限

 

 

  1.  
    # mkdir /var/public_root
  2.  
    # chown -R cent /var/public_root
  3.  
    # chmod -R 755 /var/public_root


六、开启vsftpd服务

 

 

  1.  
    # service vsftpd start
  2.  
    Starting vsftpd for vsftpd: [ OK ]


七、开启21端口

 

 

#vi /etc/sysconfig/iptables 

在上面有行22 -j ACCEPT ,在下面照打一遍,但是把22改成21。改完之后,重启iptables。

 

 

#service iptables restart 

 

八、修改selinux

 

 

#getsebool -a | grep ftp 

执行上面命令,可以看到

 

 

  1.  
    ....
  2.  
    allow_ftpd_full_access off
  3.  
    ....
  4.  
    ....
  5.  
    ftp_home_dir off

将这两个权限都打开

 

  1.  
    #setsebool -P allow_ftpd_full_access 1
  2.  
    #setsebool -P ftp_home_dir 1

重启下vsftpd

 

 

#service vsftpd restart 

 

设置成默认开启。

# chkconfig vsftpd on

centos6.8防火墙配置(代码片段)

系统:CentOSrelease6.8(Final) 执行命令:#清除所有规则iptables-F#开放redis端口iptables-AINPUT-ptcp-mtcp--dport3379-jACCEPT#开放MySql端口iptables-AINPUT-ptcp-mtcp--dport3306-jACCEPT#开放WebServer端口iptables-AINPUT-ptcp-mtc 查看详情

centos8.1配置vsftp和yum(代码片段)

使用vsftp配置本地yum源1、安装vsftp使用vmware安装好CentOS8.1后,开机会自动挂载,此时进入挂载目录下的AppStream/Packages下,执行以下命令安装vsftprpm-ivhvsftpd-3.0.3-28.el8.x86_64.rpm修改配置文件/etc/vsftpd/vsftpd.conf的anonymous_enable=NO为anonymous_... 查看详情

centos6.8下搭建svn及使用(代码片段)

查看系统环境(1)查看系统版本[[email protected]~]#cat/etc/redhat-releaseCentOSrelease6.8(Final)(2)查看系统全部信息[[email protected]~]#uname-aLinuxnode-0052.6.32-642.15.1.el6.x86_64#1SMPFriFeb2414:31:22UTC2017x86_64x86_64x86_64GNU/Linux(3)查看系统内核[[e... 查看详情

centos6.8下实现配置配额

CentOS6.8下实现配置配额  Linux系统是支持多用户的,即允许多个用户同时使用linux系统,普通用户在/home/目录下均有自己的家目录,在默认状态下,各个用户可以在自己的家目录下任意创建文件,而不用担心内存。作为系统管... 查看详情

centos6.8安装ftp及添加用户(代码片段)

一安装FTP1检测是否已经安装FTPrpm-qa|grepvsftpd2若没有,则进行安装yuminstallvsftpd二设置vsftpd开机启动chkconfig--level35vsftpdon三配置FTP服务器(开启基于用户的访问控制)1配置文件的修改vim/etc/vsftpd/vsftpd.confanonymous_enable=NO#是否开启匿名... 查看详情

vsftp配置使用(代码片段)

...的数据,VSFTP服务器可以支持15000个并发用户。vsftp的安装配置:安装vsftp需要用到root权限,尽可能的在root用户下进行安装切换root权限sudosu-1.检查vsftp是否安装rpm-qavsftp[无结果表明没有安装]2.安装vsftpyuminstall-yvsftpd[root@m01~]#yuminstal... 查看详情

centos6.8下没有yum命令解决方法(报错:-bash:yum:commandnotfound)(代码片段)

1、去http://mirrors.163.com/centos/6/os/x86_64/Packages/地址下载4个rpm安装包:python-iniparse-0.3.1-2.1.el6.noarch.rpmyum-3.2.29-81.el6.centos.noarch.rpmyum-metadata-parser-1.1.2-16.el6.x86_64.rpmyum-plugin-fast 查看详情

centos6.8下网卡配置桥接模式和nat连接模式vmware虚拟机克隆网卡配置(代码片段)

模式一:桥接模式:1.在VMware中安装好虚拟机后,虚拟机网卡设置:选择桥接模式2.查看本机的网络信息:找到ip、子网掩码、网关、DNS等。找一个没有使用的ip,例如:192.168.135.58,本机ping一下,若ping不通即没有被使用,则可以... 查看详情

centos6.8下设置gitlab服务开机自启动,关闭防火墙开机自启动(代码片段)

一.本地虚拟机的缺点本地虚拟机虽然也可以模拟服务器用,但电脑不能保证24小时都是开机的,一旦关机,服务就失去了连接,你将看到我们之前搭建的gitlab服务出现如下画面:本地电脑7*24小时不关机是不现实的,但是可以保... 查看详情

centos8.1配置vsftp和yum(代码片段)

使用vsftp配置本地yum源1、安装vsftp使用vmware安装好CentOS8.1后,开机会自动挂载,此时进入挂载目录下的AppStream/Packages下,执行以下命令安装vsftprpm-ivhvsftpd-3.0.3-28.el8.x86_64.rpm修改配置文件/etc/vsftpd/vsftpd.conf的anonymous_enable=NO为anonymous_... 查看详情

lvs_dr模式构建配置(代码片段)

 一、环境准备lvs负载均衡器    系统:centos6.8 ip:192.168.2.203  vip:192.168.2.17web服务器RS1   系统:centos6.8 ip:192.168.2.204web服务器RS2   系统:centos6.8 ip:192.168.2.204     二、安装LVS软件可以编译安装... 查看详情

centos6.8的安装和配置(代码片段)

...7-7xxx标压以上,内存16G及以上自行搜索,下载,安装VMWare准备CentOS6.8的镜像文件注意:安装虚拟机前必须开启BIOS虚拟化支持 安装CentOS    右键刚刚创建好虚拟机,在菜单中选择"设置"选项   鼠标切换:Ctrl+Alt... 查看详情

vsftp搭建(代码片段)

...ld或者iptables。systemctlstopfirewalldsystemctldisablefirewalld防火墙配置如果开启防火墙,请开放21端口,被动模式下设置最大和最小端口范围,并在防火墙开放端口范围。修改vsftpd.conf文件,添加pasv_min_port=8022#最小端口pasv_max_port=8030 查看详情

vsftp配置使用(代码片段)

vsftp简介:  VSFTP是一个基于GPL发布的类Unix系统上使用的FTP服务器软件,它的全称是VerySecureFTP从此名称可以看出来,编制者的初衷是代码的安全。  安全性是编写VSFTP的初衷,除了这与生俱来的安全特性以外,高速与高稳定... 查看详情

kvm虚机冷迁移(代码片段)

一实验环境原虚机名称:vm01-centos6.8原虚机所在宿主机:kvm-host-2迁移后虚机名称:vm01-cloud-centos6.8迁移后虚机所在宿主机:kvm-host-2二迁移过程2.1前期准备1[root@kvm-host~]#virshshutdownvm01-centos6.8 #关闭需要迁移的虚机2[root@kvm-host~]#virshli... 查看详情

mysql安装部署02-virtualbox虚拟机上centos6.8安装mysql5.1.73(代码片段)

...置,以便内外网均可访问4、安装前环境配置4.1、解决Centos6下yum无法使用的问题4.2、卸载系统自带MySQL4.3、系统配置:关闭selnux和防火墙5、安装6、总结1、环境准备VirtualBox版本:6.1MySQL版本:MySQL5.1.73操作系统版本&... 查看详情

vmware下centos6.8配置gfs文件系统

1.GFS介绍GFS简要说明,它有两种:1.Google文件系统:GFS是GOOGLE实现的是一个可扩展的分布式文件系统,用于大型的、分布式的、对大量数据进行访问的应用。它运行于廉价的普通硬件上,但可以提供容错功能。它可以给大量的用... 查看详情

vmware下centos6.8配置gfs文件系统

1.GFS介绍GFS简要说明,它有两种:1.Google文件系统:GFS是GOOGLE实现的是一个可扩展的分布式文件系统,用于大型的、分布式的、对大量数据进行访问的应用。它运行于廉价的普通硬件上,但可以提供容错功能。它可以给大量的用... 查看详情