ubuntu18配置ftp

2023-05-16

安装ftp

修改文件

sudo gedit  /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.
# ftp服务器将处于独立启动模式
listen=YES
#
# 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=NO
#
# 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.
# 启用可以修改文件的 FTP 命令
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)
# 本地用户创建文件的 umask 值
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.
# 允许为目录配置显示信息,显示每个目录下面的message_file文件的内容
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).
# 使用标准的20端口来连接ftp 
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_file之中的使用者不能更改根目录
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认证服务的配置文件名称,该文件保存在“/etc/pam.d/”目录下
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

############################################

# 设置一个本地用户登录后进入到的目录
local_root=/home/ftp
# ftp将检查userlist_file设置文件中指定的用户是否可以访问vsftpd服务器
userlist_enable=YES
# 只允许user_list文件中记录的ftp用户能登录vsftp服务,其他的ftp用户都不可以登录。
userlist_deny=NO
# 定义限制/允许用户登录的文件
userlist_file=/etc/vsftpd/allowed_users  
# ftp服务器将使用tcp_wrappers作为主机访问控制模式
tcp_wrappers=YES
# 连接ftp服务费使用的端口
listen_port=21

创建用户

sudo mkdir /home/ftp
sudo mkdir /home/ftp/data
sudo chmod -R 777 /home/ftp

sudo useradd -d /home/ftp/data -s /sbin/nologin luozw
passwd luozw


sudo mkdir /etc/vsftpd
sudo touch /etc/vsftpd/allowed_users

在这里插入图片描述

启动ftp服务

sudo service vsftpd start
service vsftpd status

删除用户

sudo userdel luozw

访问

ubuntu@ubuntu-vpc:~$ ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.209  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::ec97:df2:54f9:12e8  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c2:6a:bc  txqueuelen 1000  (以太网)
        RX packets 28293  bytes 17505049 (17.5 MB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 5623  bytes 425919 (425.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
ftp 192.168.60.209

踩坑

530 login incorrect

报错 530 login incorrect

查看

cat /etc/passwd
...
...
...
luozw:x:1001:1001::/home/ftp/data:/sbin/nologin

可以看到用户shell是:/sbin/nologin

查看shells

cat /etc/shells 
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash

添加/sbin/nologin

/bin/sh
/bin/bash
/bin/rbash
/bin/dash
/sbin/nologin

chroot_list

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

sudo gedit /etc/vsftpd.conf

chroot_list_enable=NO

在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu18配置ftp 的相关文章

  • 从 Azure VM 打开活动 FTP 连接

    我正在尝试通过 Azure VM 的活动连接连接到远程 FTP 服务器 我收到的错误是 非法 PORT 命令 我使用被动连接连接到其他 FTP 站点没有问题 但此 FTP 服务器仅支持主动连接 我的问题基本上与这个问题 https serv
  • 如何建立 FTP 连接?

    我正在尝试使用 iPhone iPad 模拟器 Xcode 设置 FTP 连接 到目前为止 我发现我需要使用 CFFTP API 但我没有成功 我浏览了网络 最终遵循了我认为最清楚的内容 即 http developer apple com
  • 从 FTP 下载文件以及如何提示用户在 ASP.NET C# 中保存/打开文件

    我想从 FTP 下载文件 并在用户单击 ASP NET C 页面上的下载按钮时在用户的 Web 浏览器中打开下载 保存提示 string strDownloadURL System Configuration ConfigurationSe
  • 如何使用 IIS 为 Amazon EC2 服务器启用 FTP 被动模式

    我最初在使用 pagelime 时遇到了问题 它要求用户使用被动模式并且不支持主动模式 让主动模式工作起来非常简单 但让被动工作模式需要付出更多的努力 我正在使用带有 IIS 的 Amazon EC2 服务器以及 FTP 站点 以下链接最终
  • PHP ftp_put 返回“无法建立数据连接:连接被拒绝”

    我有一台通过 PHP 运行一些 FTP 的 PC 我知道它在 1 2 个月前还可以工作 但现在我返回它 发现该 PC 不再工作了 我知道我一直在使用电脑 但我想不出可能会发生什么变化 PHP 抛出错误消息读取 无法建立数据连接 连接被拒绝
  • 使用python连接ftp服务器

    我尝试使用 python 代码连接到手机中的 ftp 服务器 但出现错误 Code import ftplib server ftplib FTP server connect 192 168 135 101 5556 server log
  • Ftp 仅在 .NET 4.0 中抛出 WebException

    我有以下 C 代码 当针对 NET Framework 3 5 或 2 0 编译时 它运行得很好 我没有针对 3 0 进行测试 但它很可能也能工作 问题是 当针对 NET Framework 4 0 构建时它会失败 FtpWebReques
  • 使用 PowerShell 重命名 FTP 上的文件

    有没有办法重命名 FTP 目录中的文件 我正在将实时图像从计算机流式传输到 FTP 但问题是当它将图像上传到 FTP 时 它会立即替换文件 我想先上传临时名称的图像 然后重命名为 live jpg 这就像缓存文件上传一样 while tru
  • 如何列出 FTP 连接的目录内容

    我找不到这方面的教程 在 VB NET 中我想要执行如下命令 Dim array1 as string ListFilesInFolder www example com images 我知道这可能不会那么简单 但是有人可以给我指点教程或其
  • FTP 对 PASV 命令的响应应该是什么

    我正在编写一个 FTP 服务器 但我不理解 PASV 命令 任何服务器都会发送如下响应 227 Entering Passive Mode 213 229 112 130 216 4 括号里的数字是什么意思 普通模式和被动模式有什么区别 是
  • 选择 FTP 和 HTTP 传输的缓冲区大小

    在实现低级 HTTP 和 FTP 传输时 如何选择缓冲区的大小 从套接字读取或写入套接字的字节数 以获得最大吞吐量 我的应用程序应该在 130 Kbps 到 3 Mbps 的连接上使用 HTTP 或 FTP 传输数据 我事先知道预期的速度
  • FTP 传入监控(上传时)

    我们有大约 100 个用户通过 FTP 登录并上传文件 我们的在线系统 PHP 应该显示刚刚上传的项目 我不想继续检查所有不同的 FTP 文件夹来检查新文件 在不降低服务器速度的情况下 使用 PHP 检查新文件的最佳方法是什么 所有用户都在
  • 检查 FTP 服务器上的可用空间

    我正在运行一个构建脚本 其中三个可执行文件 每个 100mb 被上传到 FTP 服务器 由于 FTP 服务器空间问题 第一次上传可能会失败 因此我们的构建过程会失败 这意味着我必须从服务器释放一些空间并再次运行构建脚本 这是浪费时间 我想在
  • 如何通过php按修改日期对文件进行排序

    背景 我有一个匿名登录 ftp 服务器 ftp nlist 仅按字母顺序列出文件 我想根据上次修改日期获取文件列表 最近的在前 我尝试了 ftp exec conn ls t 但出现了 权限被拒绝 错误 不知道为什么它不起作用 好吧 我正在
  • 如何通过FTP将多个多级(不同层次)文件从本地版本覆盖到在线版本

    我只是在本地更改了几个不同目录中的许多文件 然后将更改推送到 Subversion 但这不会更改实时版本 只会更改存储库 现在我必须通过 FTP 更新这些文件 但它们都是不同的层次结构级别 我怎么做 我知道的唯一方法是采用我的整个本地版本并
  • 如何使用 FTP 在目录之间移动文件?

    我有一个程序需要将文件从 FTP 服务器上的一个目录移动到另一个目录 例如 该文件位于 ftp 1 1 1 1 MAIN Dir1 我需要将文件移动到 ftp 1 1 1 1 MAIN Dir2 我发现了几篇推荐使用 重命名 命令的文章 因
  • 考虑到每次轮询最大消息数和 Cron,轮询如何用于 FTP 入站通道适配器

    我有 UC 我需要从 ftp 位置选取文件并将其放入服务器位置 我正在使用 ftp inbound channel adapter Spring 集成 2 0 4 来实现它 下面是我的xml中的配置
  • 如何完善这个FTP(shell)功能?

    我有大量使用以下函数的脚本 Copies files over using FTP Configurations set at the beggining of the script param 1 FTP Host 2 FTP User
  • 如何使用 shell 脚本 ftp 多个文件

    我正在尝试使用 shell 脚本将多个文件从一台计算机传输到另一台计算机 下面是我的脚本 ftp nv lt
  • 向 FTP 服务器执行跨域 XMLHTTPREQUEST 的语法是什么?

    我有一个 webDav CORS 插件 可以使用它在 webDav 服务器上 POST PUT GET REMOVE ALLDOCS 文件 我现在想对 FTP 做同样的事情 但我正在努力获取xmlhttprequest 工作语法 我只是收到

随机推荐

  • 【c/c++】单链表、头指针、头结点、首元节点

    链表中第一个结点的存储位置叫做头指针 xff0c 那么整个链表的存取就必须是从头指针开始进行了 之后的每一个结点 xff0c 其实就是上一个的后继指针指向的位置 这里有个地方要注意 xff0c 就是对头指针概念的理解 xff0c 这个很重要
  • VINS-mono学习总结

    Vins mono是一个后端基于非线性优化的 单目与IMU紧耦合的融合定位算法 整体 xff1a 1 预处理模块 视觉 xff1a 特征点提取与追踪 IMU xff1a 惯性解算与误差状态分析 计算预积分量 2 初始化模块 xff08 旋转
  • Fast-lio个人总结

    Lidar第一帧作为基坐标 1 lidar原始数据预处理默认不提取特征 xff0c 对原始数据间隔式 xff08 间隔3个点 xff09 降采样提取 2 imu初始化 惯性解算 误差分析 状态 协方差预测 3 Lidar与imu时间状态对齐
  • 在rviz中使用键盘控制burger

    启动语句 roslaunch turtlebot3 fake turtlebot3 fake launch 启动rviz 话题通信 roslaunch turtlebot3 teleop turtlebot3 teleop key laun
  • shell脚本中=左右的空格问题

    赋值语句等号两边不能有空格 xff1a i 61 1 或i 61 i 43 1 而字符串比较 xff0c 等号两边必须有空格 if a 61 b 比较时 xff0c if a xxx b 中括号前后一定要加空格否则会报错xxx 61 eq
  • freertos.axf: Error: L6218E: Undefined symbol xTaskGetSchedulerState (referred from delay.o).

    今天移植了一下FreeRTOS xff0c 出现了freertos axf Error L6218E Undefined symbol xTaskGetSchedulerState referred from delay o xff0c 这
  • vnc桌面配置及黑屏问题解决

    一 vnc桌面配置 登入需要远程帐号下修改 vnc xstartup 如配置root远程桌面 vi vnc xstartup 原内容如下 xff1a xff3b x etc vnc xstartup xff3d amp amp exec e
  • 华清嵌入式--入学篇

    当初在学习嵌入式的时候 xff0c 就知道嵌入式门槛高 xff0c 需要的知识比较多 工作了4年多时间 xff0c 确实感觉还是刚入门的感觉 xff0c 焊接 调试 原理图 PCB 模电 数电 c语言 数据结构 单片机 linux等知识比价
  • 20.华清嵌入式--数据结构入门

    从今天开始正式开始学习数据结构与算法 从今天开始正式开始学习数据结构与算法 从上面的框图也可以从整体上把握数据结构的关键知识点 xff0c 不管是简单的顺序表还是栈 xff0c 树等 xff0c 学习的方法都是一样的他们的操作也都是无非都是
  • 35.Linux应用层开发---线程

    一 线程的概念和使用 1 线程的概念 为了进一步减少处理器的空转时间 xff0c 支持多处理器以及减少上下文切换开销 xff0c 进程在演化中出现了另外一个概念线程 它是进程内独立的一条运行路线 xff0c 是内核调度的最小单元 xff0c
  • 36.Linux 应用层开发--进程间通讯

    最近因为项目原因耽误了一些时间 xff0c 导致进程间的通讯一直没有来的及学习及整理 在我们之前学过进程相关的概念和操作 xff0c 还学习了轻量级的进程的线程 xff0c 在我们之后的开发和面试中 xff0c 多线程 xff0c 多进程开
  • 树莓派4 ubuntu22.04LTS整合Intel Realsense深度相机

    树莓派4 ubuntu22 04LTS整合Intel Realsense深度相机 文章目录 树莓派4 ubuntu22 04LTS整合Intel Realsense深度相机前言一 为什么不使用Docker安装或使用官方教程安装 xff1f
  • 串口打印调试信息(干货)

    printf重定向到串口 上代码 xff0c 这里用到的是hal库 xff0c 标准库改以下函数就行 span class token macro property span class token directive keyword in
  • 相电流与线电流有什么区别

    相电流和线电流的区别 xff0c 主要看负载的连接方法 xff0c 如果是星型接法 xff0c 相电流和线电流相同 xff0c 线电压是相电压的开方3倍 如果负载是三角形接法 xff0c 那么 xff0c 线电流是相电流的开方3倍 xff0
  • STM32f103c8t6的定时器配置定时中断

    span class token comment 时间计算公式 span Tout span class token operator 61 span xff08 xff08 arr span class token operator 43
  • 集成学习方法

    概述 集成学习 xff0c 是将几个泛化能力差的模型相结合 xff0c 组成泛化能力强的模型 常见的做法就是分别训练几个模型 xff0c 然后再将多个模型的输出组合 xff0c 形成最终输出 xff0c 也称为模型平均的效果 类似的策略都称
  • (Java)常规技术面试题

    Java基础部分 1 Java 的 一次编写 处处运行 如何实现 xff1f JAVA之所以能实现 一次编译 xff0c 到处运行 xff0c 是因为JAVA在每个系统平台上都有 JAVA虚拟机 xff08 JVM xff09 xff0c
  • ESP8266烧写固件提示等待上电

    环境 供电电压 xff1a span class token number 5 span V 模块 xff1a 正点原子ATK span class token operator span ESP span class token oper
  • 嵌入式面试刷题

    1 表示一年有多少秒 define SECONDS PER YEAR 606024 365 UL 2 写一个标准宏 MIN define MIN A B A lt 61 B A B 3 指针数组 int a 10 优先级高所以是a 10 数
  • ubuntu18配置ftp

    安装ftp 修改文件 sudo gedit etc vsftpd conf span class token comment Example config file etc vsftpd conf span span class token