html文件设置ftp6,vsftp的安装与配置

环境mint17.2

1.安装

dpkg -l|grep ftp

sudo apt-get install vsftpd

2.去根目录创建一个文件上传的文件夹

sudo mkdir /ftpfile

3.创建一个用户,他只对上传文件有权限,对系统登录无权限

sudo useradd ftpuser -d /ftpfile/ -s /bin/bash

4.用chown修改ftpfile的用户和组

sudo chown -R ftpuser.ftpuser /ftpfile/

5.重置用户的密码

sudo passwd ftpuser

6.去ftpfile文件夹中创建一个html文件

sudo gedit /ftpfile/index.html

7.配置ftp服务器

先找到ftp的安装位置: whereis vsftpd

修改配置文件:sudo gedit /etc/vsftpd.conf

ftpd_banner=Welcome to vsftp service.(用户登录ftp服务器时候的欢迎信息)

local_root=/ftpfile(本地目录)

use_localtime=yes

重要的是增加这几句:

userlist_deny=NO

userlist_enable=YES

userlist_file=/etc/allowed_users

write_enable=YES

seccomp_sandbox=NO

在/etc/allowed_users增加ftpuser,这个文件表示可以登录ftp服务器的账户

设置端口范围

pam_service_name=vsftpd(采用被动模式)

pasv_min_port=61001

pasv_max_port=62000

配置防火墙iptables

sudo apt-getinstall iptables-persistent(安装配置iptables的文件)

添加防火墙规则

-A INPUT -p TCP --dport 61001:62000 -j ACCEPT

-A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT

-A INPUT -p TCP --dport 20 -j ACCEPT

-A OUTPUT -p TCP --sport 20 -j ACCEPT

-A INPUT -p TCP --dport 21 -j ACCEPT

-A OUTPUT -p TCP --sport 21 -j ACCEPT

查看修改这个文件/etc/ftpusers,这个文件里面记录的是不能登录ftp服务器的用户

sudo gedit /etc/ftpusers

重新启动防火墙

重启ftp服务器

sudo service vsftpd restart

8.ftp服务器的验证

附上/etc/vsftpd.conf整个配置文件:# Example config file /etc/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.

#

#

# Run standalone?  vsftpd can run either from an inetd or as a standalone

# daemon started from an initscript.

listen=YES

#

# Run standalone with IPv6?

# Like the listen parameter, except vsftpd will listen on an IPv6 socket

# instead of an IPv4 one. This parameter and the listen parameter are mutually

# exclusive.

#listen_ipv6=YES

#

# Allow anonymous FTP? (Disabled by default)

anonymous_enable=NO

#

# 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

#

# 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

#

# If enabled, vsftpd will display directory listings with the time

# in  your  local  time  zone.  The default is to display GMT. The

# times returned by the MDTM FTP command are also affected by this

# option.

use_localtime=YES

#

# Activate logging of uploads/downloads.

xferlog_enable=YES

#

# Make sure PORT transfer connections originate from port 20 (ftp-data).

connect_from_port_20=YES

#

# 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 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 format.

# Note that the default log file location is /var/log/xferlog in this case.

#xferlog_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

#

# 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_download_enable=YES

#

# You may fully customise the login banner string:

ftpd_banner=Welcome to blah FTP service.

local_root=/ftpfile

#

# You may specify a file of disallowed anonymous e-mail addresses. Apparently

# useful for combatting certain DoS attacks.

#deny_email_enable=YES

# (default follows)

#banned_email_file=/etc/vsftpd.banned_emails

#

# You may restrict local users to their home directories.  See the FAQ for

# the possible risks in this before using chroot_local_user or

# chroot_list_enable below.

#chroot_local_user=YES

#

# 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().

# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that

# the user does not have write access to the top level directory within the

# chroot)

#chroot_local_user=YES

#chroot_list_enable=YES

# (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

#

# Customization

#

# Some of vsftpd's settings don't fit the filesystem layout by

# default.

#

# This option should be the name of a directory which is empty.  Also, the

# directory should not be writable by the ftp user. This directory is used

# as a secure chroot() jail at times vsftpd does not require filesystem

# access.

secure_chroot_dir=/var/run/vsftpd/empty

#

# This string is the name of the PAM service vsftpd will use.

pam_service_name=vsftpd

pasv_min_port=61001

pasv_max_port=62000

#

# This option specifies the location of the RSA certificate to use for SSL

# encrypted connections.

rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem

# This option specifies the location of the RSA key to use for SSL

# encrypted connections.

rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

userlist_deny=NO

userlist_enable=YES

userlist_file=/etc/allowed_users

write_enable=YES

seccomp_sandbox=NO

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/419496.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

筛选法求1到100以内的素数

问题描述: 所谓“筛选法”指的是“埃拉托色尼(Eratosthenes)筛法”。他是古希腊的著名数学家。他采取的方法是,在一张纸上写上1到100全部整数,然后逐个判断它们是否是素数,找出一个非素数,就把它挖掉,最后剩…

Java基础知识强化之集合框架笔记27:ArrayList集合练习之去除ArrayList集合中的重复字符串元素...

1. 去除ArrayList集合中的重复字符串元素(字符串内容相同) 分析: (1)创建集合对象 (2)添加多个字符串元素(包含重复的) (3)创建新的集合 &#xf…

女生学医检好还是学计算机好,女生学医选择什么专业好?

就现在的医疗环境而言,学医不是最佳选择,很多医生都说不让自己的孩子再学医,这意味着什么,可想而知。但既然选择了学医,而且恰恰学医是自己的梦想的话,没有理由不去做好它。女孩子有自己的弱点,…

Java Servlet API中的forward()方法和redirect()方法的区别

forward():是容器中控制权的转让,在客户端浏览器地址栏不会显示转向后的地址。forward会将 request state、bean、等信息带到下一个jsp页面;使用getAttribute()来取得前一个jsp所放的信息。默…

电子科技大学计算机读博好毕业,高产博士生读博一年达毕业要求:写论文不无聊...

(原标题:成电学子读博一年达毕业要求:写论文不无聊,别把挂科当潮流)扎在实验室写代码、跑数据的许潇突然成为全校谈论的焦点,一连串“牛”、“太强了”、“佩服”钻进耳朵。“21岁保研到成电(电子科技大学),22岁成为国…

数学入门题——《算法竞赛入门经典-训练指南》

题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid94017#overview 代码链接:https://github.com/YvetteYue/ACM/tree/master/math%E5%85%A5%E9%97%A8 A题:UVA11388 GCD LCM 这道题求得是已知GCD和LCM 求最小的a情况下的a和b …

同步容器和并发容器的区别

同步容器:可以简单地理解为通过synchronized来实现同步的容器,如果有多个线程调用同步容器的方法,它们将会串行执行。比如Vector,Hashtable,以及Collections.synchronizedSet,synchronizedList等方法返回的…

当你在浏览器输入一个网址,如http://www.taobao.com,按回车之后发生了什么?

总的思路:在浏览器地址栏键入URL,按下回车之后发生的几个事件: 1)浏览器向DNS服务器请求解析该URL中的域名所对应的IP地址; 2)解析出IP地址后,根据该IP地址和默认端口80,和服务器建立…

上海音乐学院计算机考研难吗,上海音乐学院考研难吗?一般要什么水平才可以进入?...

问:从上海音乐学院毕业的学生就业怎么样?值不值得报考?答:想要了解更多毕业生就业情况见>>>就业报告汇集总之,上海音乐学院就业率相对来说是比较良好的,如果大家对此学校感兴趣的话,可…

Java-消息框显示两整数加减乘除

//两个整数加减乘除 //Qi Ming Liu,October 7,2015 import javax.swing.JOptionPane; public class Calculater { public static void main(String args[]) { //用户输入的两个数。 String firstNumber,secondNumber; //两个加数,以及和、差、积、商。 int numb…

DTO – 服务实现中的核心数据

最近实习,初接触项目,对好多的东西不是很清楚,看了下面的这篇博客对一个Web服务的实现中使用DTO及MO有了比较清楚的了解!!! http://www.cnblogs.com/loveis715/p/4379656.html 在三层模型中,ser…

Java 集合系列14之 Map总结(HashMap, Hashtable, TreeMap, WeakHashMap等使用场景)

概要 学完了Map的全部内容,我们再回头开开Map的框架图。 本章内容包括:第1部分 Map概括第2部分 HashMap和Hashtable异同第3部分 HashMap和WeakHashMap异同 转载请注明出处:http://www.cnblogs.com/skywang12345/admin/EditPosts.aspx?postid…

计算机在社区健康档案管理中的作用,某社区卫生中心对辖区居民的健康档案信息进行电子化。一直建档居民的年龄范围在1..._考试资料网...

某社区卫生中心对辖区居民的健康档案信息进行电子化。一直建档居民的年龄范围在18岁以上,但某一份健康档案中的年龄却出现了15岁;某一份健康档案中所记录的心律为1000次/分,某一份健康档案中记录的性别伟男性,但在疾病中记录有子宫肌瘤。1.信…

Select count(*)和Count(1)的区别和执行效率比较

在MySQL中Count(*)或者Count(1)或者Count([列])或许是最常用的聚合函数。很多人其实对这三者之间是区分不清的。经常会看到一些所谓的优化建议不使用Count(* )而是使用Count(1),从而可以提升性能,给出的理由是Count( *)会带来全表…