ubuntu20.04.6使用FTP-及相关安全配置

这篇具有很好参考价值的文章主要介绍了ubuntu20.04.6使用FTP-及相关安全配置。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

前言:

	作为一名运维,对文件系统,网络,文件共享,内存,CPU,以及一些应用服务及监控相关的知识需要
了解。今天是自己第一次搭建FTP(以前用过smb,windows共享,FTP,也自己搭建了SMB,但是FTP是
自己第一次搭建)
	经过了解,linux的smb在历史上被攻破过,ftp没有相关的传闻,但是不敢肯定没有“0day”
漏洞。
	在NFS,Samba,FTP等网络文件共享协议中,FTP是当前共享文件中运用最广泛的。
	常见的FTP产品有:vsftp;proftp;wu-ftp,pureftp。他们没有什么区别。选择自己习
惯使用的一款即可。
	本文选择vsftp来做一些ftp文件共享方面的使用习惯记录。仅供参考。
	在生产环境中使用,一定要注意对ftp用户进行最小权限的授权。ftp的配置也要进行限制。
	(- _ ^)

vsftp的安装

sudo apt-get install vsftpd

创建ftp的用户文件夹及文件存放文件夹

cd /home
sudo mkdir bankdata
cd bankdata
sudo mkdir bankexcel bankresult

添加用户账号,指定用户目录及登录bash

sudo useradd bankdata-d /home/bankdata/ -s /bin/bash 

设置用户密码

sudo passwd bankdata

修改ftp配置文件

本配置主要是限制了用户只能在自己的家目录及子目录中,不允许串门到其它任何地方文章来源地址https://www.toymoban.com/news/detail-737489.html

# 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

服务的重启,启动,停止

sudo service vsftpd restart
sudo systemctl start vsftpd
sudo systemctl stop vsftpd

注意事项

	常见的错误:FTP连接时出现“227 Entering Passive Mode”
	客户端的主动与被动模式有一些区别,可能会因为一些防火墙策略导致传输数据失败。需要注意选择客户端的“主动”
或者“被动” 模式

常用命令

客户端连接服务端成功后,直接输入“help”, 如下:
ftp:/> help
ascii    set ascii transfer type
bin      set binary transfer type
binary   set binary transfer type
cd       change remote working directory
cdup     change remote working directory to parent directory
delete   delete remote file
dir      list contents of remote directory
exit     terminate ftp session and exit
get      receive file
help     print local help information
lcd      change local working directory
ldir     list contents of local directory
lls      list contents of local directory
lpwd     print working directory on local machine
ls       list contents of remote directory
mget     get multiple files
mkdir    make directory on the remote machine
mput     put multiple files
mv       rename file
passive  toggle pasive transfer mode
put      send one file
quit     terminate ftp session and exit
quote    send arbitrary ftp command
rename   rename file
rm       delete remote file
rmdir    remove directory on the remote machine
user     send new user information
ftp:/> 


到了这里,关于ubuntu20.04.6使用FTP-及相关安全配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【Linux】ubuntu使用root用户登录系统详细教程(ubuntu16.04+ubuntu20.04都有)

    目录 一:Ubuntu 16.04使用root用户登录系统 二:Ubuntu 20.04使用root用户登录系统 使用root用户登录系统【Ubuntu 16.04 + Ubuntu 20.04都有】 Ubuntu 系统版本确认是否为Ubuntu 16.04, 这里注意 不是VMware版本! 不同用户设置界面可能不同,但在 设置-关于 中都可以进行查看  修改Ubuntu系统

    2024年01月22日
    浏览(59)
  • Ubuntu20.04配置YOLOV5算法相关环境,并运行融合YOLOV5的ORB-SLAM2开源代码(亲测有效)

              这篇博客介绍的是如何在Ubuntu系统下配置YOLOV5算法环境。并且运行一个融合YOLOV5的ORB-SLAM2开源代码。         安装的软件主要是anaconda,然后anaconda可以帮我们安装python、pytorch这些东西。我的ubuntu版本:ubuntu20.04.5LTS。 安装的anaconda类型: Anaconda3-2022.05 安装的p

    2024年02月02日
    浏览(37)
  • 【WSL】使用WSL在Windows上安装Linux(Ubuntu20.04)

    本文将介绍在win11系统下使用Windows自带的WSL功能安装Ubuntu20.04子系统,其中WSL2本质仍是基于Hyper-V的虚拟机。 Windows11 + WSL2 + Ubuntu20.04 (WSL译为适用于 Linux 的 Windows 子系统) 在Windows设置中添加可选功能,勾选 适用于Linux的Windows子系统(即WSL) 和 虚拟机平台 ,开启该功能需重

    2024年02月12日
    浏览(39)
  • 【ubuntu】ubuntu 20.04安装docker,使用nginx部署前端项目,nginx.conf文件配置

    docker 官网:Install Docker Engine on Ubuntu 1.将apt升级到最新 2.使用apt安装 docker 和 docker-compose (遇到提示输入 y ) 3.将当前用户添加到docker用户组 4.运行hello-world 运行成功 1.修改配置文件 修改conf/nginx.conf 2.重新挂载 给容器设置自启动(如果提示就去掉sudo) 给docker设置开机自启动

    2024年01月20日
    浏览(44)
  • ubuntu20.04安装Carla并配置罗技G29方向盘使用

    环境 :ubuntu20.04+anaconda+python3.7+ros2 foxy+Logitech g29 一、安装Carla github地址: https://github.com/carla-simulator/carla 安装文档: https://carla.readthedocs.io/en/0.9.13/ 安装的版本:0.9.13 主要步骤: 1.1 将0.9.13版本的Carla安装包下载到本地并解压CARLA_0.9.13.tar.gz 1.2 测试是否能正常启动 有画面弹出说

    2023年04月24日
    浏览(39)
  • Ubuntu20.04安装配置gitlab及使用git管理代码超详细教程

    目录 简介 安装教程 安装gitlab 配置Gitlab  登录gitlab  gitlab内存优化  创建用户  创建群组 添加成员进群组 管理群组成员权限   创建项目 分支管理  使用git bash工具 下载git bash 上传代码 使用sourceTree工具创建分支 提交分支 gitlab服务器邮箱的配置(可选) 今日推荐  GitLab是

    2024年02月21日
    浏览(79)
  • 【服务器管理】Ubuntu20.04安装包管理工具module配置并且使用

    module 是一个专门管理环境变量的工具,全称是module environment,一般应用于软件或运行库等设备有多个版本,且需要分别配置这些环境变量。其官网为: https://modules.readthedocs.io/en/latest/index.html 通常,对于多版本的软件包,我们可以通过修改 ~/.bashrc 文件,通过修改 PATH 、 LD_LI

    2024年02月09日
    浏览(37)
  • Linux桌面端Ubuntu20.04安装和使用netplan修改IP地址

    1. 点击右上角的有线连接: 2. 进入后点击设置按钮:  3. 先点击IPv4,然后选择手动,再在地址处输入想要的IP地址,点击应用,则完成修改。 ​​​​​​ 首先输入: 安装完成后,进入安装文件夹: 打开配置的yaml文件: 进入后一般为空白,配置内容(复制后Ctrl+V): 这

    2024年02月15日
    浏览(42)
  • 【Ubuntu22.04】配置静态IP地址和FTP服务

    使用命令 ip a 查看当前网卡名称,Ubuntu22.04默认网卡为ens33: 使用命令 tree /etc/netplan 查看默认网卡配置文件: 使用命令 vi /etc/netplan/00-installer-config.yaml 编辑默认网卡配置: 修改前: 修改后: 使用命令 sudo netplan apply 保存并启用配置,再次查看ip地址,并使用 ping www.baidu.com

    2024年02月08日
    浏览(49)
  • ubuntu20.04下安装,运行关于opencv的Python程序相关库

    最初对ubuntu20.04以及opencv和python运行环境一窍不通,折磨了好几天,虚拟机重建了好几次,各个帖子的方法都跑遍了。最后终于装上,记录一下,免得搞忘。 先总结下之前的问题:推测之前的问题都在于我先入为主安装了vscode上的Python,但其实ubuntu20.04他是自带了Python3.8.10的

    2024年02月13日
    浏览(25)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包