首页 > 系统相关 >ubuntu搭建ftp服务器

ubuntu搭建ftp服务器

时间:2023-04-23 17:13:26浏览次数:39  
标签:ftp enable vsftpd chroot user file ubuntu 服务器 YES

一、安装vsftp:         

sudo apt install vsftpd

vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点。

二、修改配置文件(在修改之前最好备份一下)

sudo cp  /etc/vsftpd.conf /etc/vsftpd.conf.backup
sudo vim /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=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
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.
#
# 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
#
# 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
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES
vsftp.conf

 


三、创建 ftpjxk 用户

 

sudo useradd -d /data/ftpdir -s /bin/bash ftpjxk

 

 

 

四、添加ftpjxk 用户密码

 

sudo passwd ftpjxk

 

创建 ftpuser的家目录并将其所属用户和所属组改为 ftpuser

 

 



标签:ftp,enable,vsftpd,chroot,user,file,ubuntu,服务器,YES
From: https://www.cnblogs.com/ldx-wsj/p/17347096.html

相关文章

  • 解决ubuntu上回环设备/dev/loop0占用100%的问题
    当前ubuntu环境12cat/etc/issueUbuntu19.04\n\l当我们查看文件系统占用情况时,发现有/dev/loop0至/dev/loop7占用率为100%。1234567891011121314151617df-hFilesystemSizeUsedAvailUse%Mountedonudev3.9G03.9G0%/......
  • 服务器遭受攻击之后的常见思路
    哈喽大家好,我是咸鱼 不知道大家有没有看过这么一部电影: 这部电影讲述了男主是一个电脑极客,在计算机方面有着不可思议的天赋,男主所在的黑客组织凭借着超高的黑客技术去入侵各种国家机构的系统,并引起了德国秘密警察组织、欧洲刑警组织的重视 刚开始看的时候以为是一部讲述......
  • SRS流媒体服务器之HTTP-FLV框架分析
    SRS流媒体服务器之HTTP-FLV框架分析链接:https://www.isolves.com/it/cxkf/kj/2021-03-25/37488.html介绍的代码和现版本代码有出处,但对流程序的理解有相当的价值。简要笔记如下。整体的框架:RTMP推流端-----》SRS流媒体服务器(建立SOURCE->生成Consumer->指定封装格式endoder=F......
  • 服务器重装系统
    HUAWEI服务器重装系统指南第一步配网这一步主要实现远程连接服务器功能,具体操作为找一个显示器和一个键盘。显示器插上电源后,将VGA信号线(也就是蓝色头线)连接显示器和服务器,键盘线连接服务器,然后重启服务器,按下Del键,然后转到如果让输入密码则输入默认密码Admin@9000进到BIO......
  • ftp命令总结
    >>ftp222.71.99.11Connectedto  222.71.99.11( 222.71.99.11).............Name( 222.71.99.11:test1): >>你的账号名331PasswordrequiredforeigPassword: >>你的密码230LoggedonRemotesystemtypeisUNIX.ftp>bin使用bin命令指定文件格式为binary......
  • ubuntu 22.04 开机自启动脚本
    ubuntu22.04开机自启动脚本1、完善rc-local.service服务vi/lib/systemd/system/rc-local.service添加红色框框部分[Install]WantedBy=multi-user.targetAlias=rc-local.service2、添加/etc/rc.local文件创建文件touch/etc/rc.local在/etc/rc.local文件里面......
  • 在服务器上安装jenkins
    jenkins.warjdk-8u131-linux-x64.tarapache-tomcat-7.0.68.tar上传服务器上述安装包,安装好jdk,tomcat,验证是否安装成功,然后把tomcat/webapps/ROOT目录里的文件都删除掉,把jenkins.war拷贝到ROOT目录下,然后解压jar-xvfjenkins.war。然后返回tomcat/conf目录中,编辑server.xml......
  • 测试环境服务器配置、生成环境服务器配置、测试机配置
    测试环境服务器配置:CPU:2核  内存:4GB(I/O优化)带宽5Mbps生产环境服务器配置:前端服务器3台配置CPU:4核  内存:4GB 带宽20Mbps;后端2台配置 CPU:4核  内存:8GB 带宽5Mbps测试机配置:CPU:8核内存:16G Speed:1000Mb/s......
  • 什么是大带宽服务器? 如何选择?
    简述大带宽服务器己面世很久,为什么会命名为大带宽服务器?与其他服务器的差别在那?大带宽服务器适合什么业务用户?文章内会详细为大家解说什么是大带宽服务器?大带宽的定义很广泛,有些IDC定义大带宽服务器为100M,有些IDC定义为1G,更有些IDC机房定义为10G,以服务器的唯一功能就......
  • Tailscale 基础教程:部署私有 DERP 中继服务器(转)
    Sealos 在云桌面中管理Kubernetes集群生命周期,运行分布式应用程序 走,看看去!上篇文章介绍了如何使用 Headscale 替代Tailscale官方的控制服务器,并接入各个平台的客户端。本文将会介绍如何让Tailscale使用自定义的DERPServers。可能很多人都不知道 DERP 是个啥玩意......