2022
我们一起努力

vsftpd配置文件(vsftpd配置文件路径)

本文目录:

  • 1、CentOS7安装及配置vsftpd-精简绝版
  • 2、如何备份vsftpd的配置文件
  • 3、如何配置vsftpd.conf
  • 4、限制虚拟用户的家目录的家目录的配置是什么
  • 5、7.9 用vsftpd 配置基于IP的虚拟FTP 服务器

CentOS7安装及配置vsftpd-精简绝版

备注:如果后期想变更此用户的上传目录到

(/run/media/root/xxx/wwwroot/ xxx.org ),

请使用下面的命令:

输入怎么想设置的密码则可。

(1)当我们限定了用户不能跳出其主目录之后,使用该用户登录FTP时往往会遇到这个错误:

500 OOPS: vsftpd: refusing to run with writable root inside chroot ()

(2)从2.3.5之后,vsftpd增强了安全检查,如果用户被限定在了其主目录下,

则该用户的主目录不能再具有写权限了!如果检查发现还有写权限,就会报该错误。

要修复这个错误,可以用命令chmod a-w /home/user去除用户主目录

的写权限,注意把目录替换成你自己的。

或者你可以在vsftpd的配置文件中增加下列一项:

allow_writeable_chroot=YES

(3)使用cmd命令容器发生

500 OOPS: could not read chroot() list file:/etc/vsftpd/chroot_list错误

解决:修改vsftpd.conf配置文件,注释以下内容

(4)本地使用ftpClient调试是发生

java.net.SocketException: Connection reset异常

解决:在本地电脑执行以下命令

netsh advfirewall set global StatefulFTP disable

# 启动服务

systemctl start vsftpd.service

# 停止服务

systemctl stop vsftpd.service

# 重启服务

systemctl restart vsftpd.service

# 服务状态查看

systemctl status vsftpd.service

# 设置开机启动

systemctl enable vsftpd

如何备份vsftpd的配置文件

根据 /etc/vsftpd/vsftpd.conf默认配置给出设定功能 # Example config file /etc/vsftpd/vsftpd.conf# The default compiled in settings are fairly paranoid. This sample file# loosens things up a bit, to make the ftp daemon more usable.# Please see vsftpd.conf.5 for all compiled in defaults.# READ THIS: This example file is NOT an exhaustive list of vsftpd options.# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd’s# capabilities.# 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允许使用任何可以修改文件系统的FTP的指令# Default umask for local users is 077. You may wish to change this to 022,# if your users expect that (022 is used by most other ftpd’s)local_umask=022本地用户新增档案的权限# Uncomment this to allow the anonymous FTP user to upload files. This only# has an effect if the above global write enable is activated. Also, you will# obviously need to create a directory writable by the FTP user.#anon_upload_enable=YES允许匿名用户上传文件# Uncomment this if you want the anonymous FTP user to be able to create# new directories.#anon_mkdir_write_enable=YES允许匿名用户创建新目录# Activate directory messages – messages given to remote users when they# go into a certain directory.dirmessage_enable=YES允许为目录配置显示信息,显示每个目录下面的message_file文件的内容# Activate logging of uploads/downloads.xferlog_enable=YES开启日记功能 # Make sure PORT transfer connections originate from port 20 (ftp-data).connect_from_port_20=YES使用标准的20端口来连接ftp # 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 #chown_username=whoever 匿名上传文件所属用户名 # You may override where the log file goes if you like. The default is shown# below.#xferlog_file=/var/log/vsftpd.log日志文件位置 # If you want, you can have your log file in standard ftpd xferlog formatxferlog_std_format=YES使用标准格式 # 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数据传输超时 # It is recommended that you define on your system a unique user which the# ftp server can use as a totally isolated and unprivileged user.#nopriv_user=ftpsecure当服务器运行于最底层时使用的用户名 # Enable this and the server will recognise asynchronous ABOR requests. Not# recommended for security (the code is non-trivial). Not enabling it,# however, may confuse older FTP clients.#async_abor_enable=YES允许使用\”async ABOR\”命令,一般不用,容易出问题 # By default the server will pretend to allow ASCII mode but in fact ignore# the request. Turn on the below options to have the server actually do ASCII# mangling on files when in ASCII mode.# Beware that on some FTP servers, ASCII support allows a denial of service# attack (DoS) via the command “SIZE /big/file” in ASCII mode. vsftpd# predicted this attack and has always been safe, reporting the size of the# raw file.# ASCII mangling is a horrible feature of the protocol.#ascii_upload_enable=YES 管控是否可用ASCII 模式上传。默认值为NO#ascii_download_enable=YES管控是否可用ASCII 模式下载。默认值为NO# You may fully customise the login banner string:#ftpd_banner=Welcome to blah FTP service. login时显示欢迎信息.如果设置了banner_file则此设置无效 # You may specify a file of disallowed anonymous e-mail addresses. Apparently# useful for combatting certain DoS attacks.#deny_email_enable=YES 如果匿名用户需要密码,那么使用banned_email_file里面的电子邮件地址的用户不能登录# (default follows)#banned_email_file=/etc/vsftpd/banned_emails禁止使用匿名用户登陆时作为密码的电子邮件地址 # 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_list_enable=YES如果启动这项功能,则所有列在chroot_list_file中的使用者不能更改根目录 # (default follows)#chroot_list_file=/etc/vsftpd/chroot_list定义不能更改用户主目录的文件 # You may activate the “-R” option to the builtin ls. This is disabled by# default to avoid remote users being able to cause excessive I/O on large# sites. However, some broken FTP clients such as “ncftp” and “mirror” assume# the presence of the “-R” option, so there is a strong case for enabling it.#ls_recurse_enable=YES 是否能使用ls -R命令以防止浪费大量的服务器资源 # 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 绑定到listen_port指定的端口,既然都绑定了也就是每时都开着的,就是那个什么standalone模式 # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6# sockets, you must run two copies of vsftpd whith two configuration files.# Make sure, that one of the listen options is commented !!#listen_ipv6=YESpam_service_name=vsftpd 定义PAM 所使用的名称,预设为vsftpduserlist_enable=YES 若启用此选项,userlist_deny选项才被启动 tcp_wrappers=YES 开启tcp_wrappers支持

如何配置vsftpd.conf

VSFTP的软件安装包是: vsftpd-2.2.2-12.el6_5.1.i686.rpm

查询:#rpm -q vsftpd

安装:#rpm -ivh vsftpd-2.2.2-12.el6_5.1.i686.rpm或者直接yum install vsftpd

启动、停止及重启VSFTP的命令: #service vsftpd start/stop/restart

配置文件:

/etc/vsftpd/vsftpd.conf //主配置文件

/etc/vsftpd.ftpusers //被禁止登录FTP的用户文件

/etc/vsftpd.user_list //允许登录FTP的用户文件

a、将登录后的用户限制在本地家目录下:

#vi /etc/vsftpd/vsftpd.conf

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list

新建受限用户的列表文件并加入受限用户名

#vi /etc/vsftpd.chroot_list

raykeso

重启ftp服务

#service vsftpd restart

b、/etc/vsftpd/vsftpd.conf 主要参数讲解

anonymous_enable=YES/no 是否允许匿名用户登录

anonymous_enable=yes/no 是否允许匿名上传文件

local_enable= YES/no 是否允许本地用户登录

write_enable= YES/no 是否允许本地用户上传

guest_enable=yes/no 是否允许虚拟用户登录;

local_mask=022 设置本地用户的文件生成掩码为022,默认值为077

dirmessage_enable= YES 设置切换到目录时显示。message隐含文件的内容

xferlog_enable= YES 激活上传和下载日志

connect_from_port_20=YES 启用FTP数据端口连接

pam_service_name=vsftpd 设置PAM认证服务的配置文件名称, 该文件存放在/etc/pam.d目录下

限制虚拟用户的家目录的家目录的配置是什么

centos 6.5 vsftpd 虚拟用户配置

一:基本知识

1:虚拟用户:与系统无关联,不能登入系统,只能访问FTP服务器

2:vsftp的服务进程是vsftpd

3:vsftpd的配置文件是/etc/vsftpd/vsftpd.conf .

4:vsftpd的用户文件是/etc/vsftpd/ftpusers

5:vsftpd的用户文件是/etc/vsftpd/user_list

6:推荐使用虚拟用户登入vs-FTP服务器

二:安装

1.检查是否安装过vsftpd

rpm -qa vsftpd

安装:

(1) yum -y install vsftpd lftp

(2) 关闭iptables 和 selinux

/etc/init.d/iptables stop

临时关闭selinux

setenforce 0

永久性的关闭selinux

vim /etc/selinux/config

修改为 ————》SELINUX=disabled

(3) 创建虚拟用户文本文件,添加用户及密码

cd /etc/vsftpd

touch vuser.txt

备注:奇数行是用户名,偶数行是密码。例如:

alix

123456

(4) 生成虚拟数据库文件(需使用到db_load)

yum -y install db4-utils db4-devel db4-4.3

db-load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.db

(5) 配置PAM文件,用来验证客户端

vim /etc/pam.d/vsftpd

authrequiredpam_userdb.sodb=/etc/vsftpd/vuser

accountrequiredpam_userdb.sodb=/etc/vsftpd/vuser

(6)修改虚拟数据库文件的权限

chmod 700 /etc/vsftpd/vuser.db

(7) 增加一个系统用户vuser,用于匿名用户的映射。

mkdir /data

useradd -d /data vuser

chown vuser.vuser /data

usermod -s /sbin/nologinvuser

(8) 修改主配置文件vsftpd.conf,添加:

guest_enable=YES ##激活虚拟用户

guest_uaername=vuser##把虚拟用户绑定为系统账户vuser

pam_service_name=vuser##使用pam认证

(9) 添加虚拟用户的配置文件

vim /etc/vsftpd/vsftpd.conf

添加:user_config_dir=/etc/vsftpd/vsftpd_user_conf

(10) 创建vsftpd_user_conf目录

mkdir /etc/vsftpd/vsftpd_user_conf

(11) 设置虚拟用户配置文件,与虚拟用户名相同

touch /etc/vsftpd/vsftpd_user_conf/testuser

(12) 编辑虚拟用户配置文件

vim /etc/vsftpd/vsftpd_user_conf/testuser

anon_world_readable_only=NO ###浏览FTP目录和下载

anon_upload_enable=YES ###允许上传

anon_mkdir_write_enable=YES ###建立和删除目录

anon_other_write_enable=YES ####改名和删除文件

local_root=/ftpdir/ #### 指定虚拟用户在系统用户下面的路径,限制虚拟用户的家目录,虚拟用户登录后的主目录。

备注:一定要检查后面是否有空格。

(13)启动

/etc/init.d/vsftpd restart

三。添加新的虚拟用户

添加虚拟用户

vim /etc/vsftpd/vuser.txt

web2

123456

生成库文件

db-load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.db

编辑虚拟用户的配置文件

touch /etc/vsftpd/vsftpd_user_conf/web2

vim /etc/vsftpd/vsftpd_user_conf/web2

anon_world_readable_only=NO ###浏览FTP目录和下载

anon_upload_enable=YES ###允许上传

anon_mkdir_write_enable=YES ###建立和删除目录

anon_other_write_enable=YES ####改名和删除文件

local_root=/ftpdir/ #### 指定虚拟用户在系统用户下面的路径,限制虚拟用户的家目录,虚拟用户登录后的主目录。

创建用户家目录

mkdir /ftpdir/web2

修改权限

chown -R vuser.vuser /ftpdir/web2

加载vsftpd

/etc/init.d/vsftpd reload

本地连接:

ftp

(需要把vsftpd.conf 里的ssl关了)

lftp

(在 /etc/l里添加 set ssl:verify-certificate no)

四、配置ssl

1、安装包

apt-get -y install openssl

2、创建一个证书(时间365天)并填写相关一些信息

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out /etc/ssl/certs/vsftpd.pem -keyout /etc/ssl/certs/vsftpd.pem

Generating a 2048 bit RSA private key

……….+++

………….+++

writing new private key to ‘/etc/ssl/certs/vsftpd.pem’

—–

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter ‘.’, the field will be left blank.

—–

Country Name (2 letter code) [AU]:CN

State or Province Name (full name) [Some-State]:shanghai

Locality Name (eg, city) []:shanghai

Organization Name (eg, company) [Internet Widgits Pty Ltd]:aaa

Organizational Unit Name (eg, section) []:aaa

Common Name (e.g. server FQDN or YOUR name) []:aaa

Email Address []:

3、修改权限

chmod 0400 /etc/ssl/certs/vsftpd.pem

4、ssl具体配置/etc/vsftpd.conf最后添加

ssl_enable=YES

rsa_cert_file=/etc/ssl/certs/vsftpd.pem

ssl_sslv2=YES

ssl_sslv3=YES

ssl_tlsv1=YES

5、配置说明

ssl_enable=YES #开启vsftpd对ssl协议的支持

ssl_sslv2=YES #支持SSL v2 protocol

ssl_sslv3=YES #支持SSL v3 protocol

ssl_tlsv1=YES #支持TSL v1

rsa_cert_file=/etc/ssl/certs/vsftpd.pem #存放证书地方

6、重启服务

/etc/init.d/vsftpd restart

Stopping FTP server: vsftpd.

Starting FTP server: vsftpd.

7、测试

1)lftp fileftp:’redhat’@192.168.1.124

ls: Fatal error: Certificate verification: Not trusted

解决在/etc/l文件中添加1行到最后

set ssl:verify-certificate no

再登录一次就OK了

2)查看日志

Sat Aug 1 13:52:23 2015 [pid 2] CONNECT: Client “192.168.1.124”

Sat Aug 1 13:52:23 2015 [pid 2] DEBUG: Client “192.168.1.124”, “Connection terminated without SSL shutdown – buggy client?”

Sat Aug 1 13:56:25 2015 [pid 2] CONNECT: Client “192.168.1.120”

Sat Aug 1 13:56:25 2015 [pid 1] [fileftp] OK LOGIN: Client “192.168.1.120”

7.9 用vsftpd 配置基于IP的虚拟FTP 服务器

配置虚拟IP 地址

建立虚拟FTP 的服务器目录并设置适当的权限

建立虚拟FTP 的服务器的xinetd 配置文件

建立虚拟FTP 的服务器的主配置文件

配置独立启动的虚拟FTP 的服务器要有单独的主配置文件,即原主机的主配置文件和虚拟主机的配置文件不能重名。

⑴ 查看本机现有的IP 地址

# ifconfig |grep -1 eth0

eth0 Link encap:Ethernet HWaddr 00:50:56:C7:22:DF

inet addr:192.168.1.222 Bcast:192.168.1.255 Mask:255.255.255.0

//可以看出本机的第一个网络接口eth0 的IP 为192.168.1.222

⑵ 下面配置一个虚拟网络接口eth0:1

# ifconfig eth0:1 192.168.1.234 up

⑶ 下面建立虚拟FTP 的服务器目录

# mkdir -p /var/ftp2/pub

//确保目录具有如下的权限

# ll -d /var/ftp2

drwxr-xr-x 3 root root 4096 3 月12 03:00 /var/ftp2

# ll -d /var/ftp2/pub

drwxr-xr-x 2 root root 4096 3 月12 03:00 /var/ftp2/pub

⑷ 在下载目录中生成测试文件

# echo “hello”/var/ftp2/pub/test_file

⑸ 下面创建此虚拟服务器的匿名用户所映射的本地用户ftp2

# useradd -d /var/ftp2 -M ftp2

⑹ 修改原独立运行服务器的配置文件/etc/vsftpd/vsftpd.conf

# vi /etc/ vsftpd/vsftpd.conf

// 添加listen = 192.168.1.222

// 将原FTP 服务绑定到eth0 接口,之后保存退出vi

⑺ 生成新的虚拟FTP 服务器的配置文件/etc/vsftpd/vsftpd2.conf

# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd2.conf

⑻ 更改新的配置文件/etc/vsftpd/vsftpd2.conf

# vi /etc/vsftpd/vsftpd2.conf

//在此文件添加

//listen_address= 192.168.1.234

//将虚拟FTP 服务绑定到eth0:1 接口

⑼ 修改如下的配置语句行:

// ftpd_banner=This FTP server is anonymous only.

//修改为:

// ftpd_banner=This is the alternative FTP site.

⑽ 添加如下的配置语句:

// ftp_username=ftp2

//使此虚拟服务器的匿名用户映射到本地用户ftp2

//这样匿名用户登录后才能进入本地用户ftp2 的/var/ftp2 目录

//修改后,保存退出vi

⑾ 重启服务器:

service vsftpd restart

启动虚拟FTP服务器

Vsftpd /etc/vsftpd/vsftpd2.conf

vsftpd配置文件】的内容来源于互联网,如引用不当,请联系我们修改。

赞(0)
文章名称:《vsftpd配置文件(vsftpd配置文件路径)》
文章链接:https://www.fzvps.com/38164.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!