首页 > 系统相关 >How to set up File Transfer Protocol(FTP) server in Linux

How to set up File Transfer Protocol(FTP) server in Linux

时间:2025-01-22 14:31:26浏览次数:3  
标签:FTP set Protocol sudo vsftpd home ftpuser YES

Step 1: Install vsftpd

To set up an FTP server in Linux, first, you have to ensure vsftpd is installed:

For Ubuntu/Debian:

sudo apt update
sudo apt install vsftpd -y

For CentOS/RHEL:

sudo yum install vsftpd -y

Step 2: Basic Configuration of vsftpd

Configure vsftpd to allow basic FTP connections and set user restrictions.

  1. Open the vsftpd configuration file:
    sudo nano /etc/vsftpd.conf

  2. Edit/add the following settings for a secure FTP setup, the FTP folder in this case will be /home/$USER/FTP:
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    chroot_local_user=YES
    allow_writeable_chroot=YES
    chroot_local_user=YES
    user_sub_token=$USER
    local_root=/home/$USER/ftp

  3. Save and close the file.
  4. Restart vsftpd to apply changes:
    sudo systemctl restart vsftpd

Step 3: Create FTP Users

To allow specific users to access the FTP server:

  1. Create a new user (replace <username> with the desired username):
    sudo adduser <username>

  2. Create an FTP upload directory for the user:
    sudo mkdir /home/<username>/ftp
    sudo chown <username> /home/<username>/ftp

Step 4: Test the FTP Server Configuration

To connect to the FTP server, use an FTP client like FileZilla:

  1. Open FileZilla
  2. Enter your server IP, username, and password, then click Connect.

Troubleshooting Tips

Check logs for errors:

sudo tail /var/log/vsftpd.log

Ctrl+C Sanctuary

The entire guide is distilled into copy-paste perfection—tested, hassle-free, and ready to go.

Ubuntu/ Debian Based :

sudo apt update
sudo apt install vsftpd -y
sudo echo -e "write_enable=YES\nchroot_local_user=YES\nallow_writeable_chroot=YES\nchroot_local_user=YES\nuser_sub_token=$USER\nlocal_root=/home/$USER/ftp" >> /etc/vsftpd.conf
sudo systemctl restart vsftpd
useradd -m ftpuser;echo "ftpuser:ftpuser" | chpasswd
sudo mkdir /home/ftpuser/ftp
sudo chown ftpuser /home/ftpuser/ftp

Fedora/ RHEL Based :

sudo dnf update -y
dnf install vsftpd -y
sudo echo -e "write_enable=YES\nchroot_local_user=YES\nallow_writeable_chroot=YES\nchroot_local_user=YES\nuser_sub_token=$USER\nlocal_root=/home/$USER/ftp" >> /etc/vsftpd.conf
sudo systemctl restart vsftpd
useradd -m ftpuser;echo "ftpuser:ftpuser" | chpasswd
sudo mkdir /home/ftpuser/ftp
sudo chown ftpuser /home/ftpuser/ftp

标签:FTP,set,Protocol,sudo,vsftpd,home,ftpuser,YES
From: https://blog.csdn.net/Evoxt/article/details/145302765

相关文章

  • 如何在 Linux 服务器上设置 FTP 文件传输协议
    第一步:安装vsftpd要在Linux上设置FTP服务器,首先需要确保已安装vsftpd。对于Ubuntu/Debian系统:sudoaptupdatesudoaptinstallvsftpd-y对于CentOS/RHEL系统:sudoyuminstallvsftpd-y第二步:配置vsftpd配置vsftpd以允许基本的FTP连接并设置用户限......
  • 详解Redis的Zset类型及相关命令
    目录Zset简介ZADDZCARDZCOUNTZRANGEZREVRANGEZRANGEBYSCOREZPOPMAXBZPOPMAXZPOPMINBZPOPMINZRANKZREVRANKZSCOREZREMZREMRANGEBYRANKZREMRANGEBYSCOREZINCRBYZINTERSTORE内部编码应用场景Zset简介有序集合相对于字符串、列表、哈希、集合来说会有......
  • ROLLUP, CUBE, GROUPING Functions and GROUPING SETS
    ORACLE-BASE-ROLLUP,CUBE,GROUPINGFunctionsandGROUPINGSETS看不懂的可以来问-------------------------------------------------------------------------------------------------------------------------------完了,我也看不懂了思考一下几个SQL的resultsets......
  • 升级到MySQL 8.4,MySQL启动报错:io_setup() failed with EAGAIN
    在升级到MySQL8.4后,许多用户在启动数据库时遇到了一种常见错误:“io_setup()failedwithEAGAIN”。本文将深入探讨该错误的原因,并提供详细的解决方案。错误分析错误描述当你启动MySQL时,可能会在日志文件中看到以下错误信息:io_setup()failedwithEAGAIN​  这个......
  • Redis数据库笔记——ZSet的底层实现(跳表)
    大家好,这里是GoodNote,关注公主号:Goodnote,专栏文章私信限时Free。本文详细介绍ZSet数据类型中跳表的底层实现,包括基本特点和常用操作。文章目录ZSet(有序集合)概述基本特点底层实现Skiplist跳表概述结构跳表的基本操作1.查找操作:`Search`2.插入操作:`Insert`3.删......
  • Vue3 在defineProps中某个属性的默认值使用多语言i18n 异常defineProps()` in <script
    原代码<scriptsetuplang="ts">constprops=defineProps({modelValue:{type:Array,default:[]},typeName:{type:String,default:t('TypeName')},disabled:{type:Boolean,default:false......
  • vue3 setup函数 有哪些参数,props、{attrs,slots,emit}等
    在Vue3中,setup函数是CompositionAPI的入口点,用于替代传统的data、methods、computed等选项。setup函数可以接收两个参数:props和context。下面详细解释这两个参数及其用途。setup函数签名import{SetupContext}from'vue';exportdefault{props:{//......
  • Chapter 6.2-Preparing the dataset
    Chapter6-Fine-tuningforclassification6.2-Preparingthedataset如下图所示,分类微调LLM的三阶段过程数据集准备。模型设置。微调和评估模型。本节准备用于分类微调的数据集。我们使用一个包含垃圾邮件和非垃圾邮件文本的数据集,对大语言模型(LLM)进行微调......
  • 如何使用FTP和数据库修改网站
    在拥有FTP和数据库访问权限的情况下,您可以对网站进行各种修改,包括内容更新、模板调整、数据库操作等。以下是详细的修改步骤和注意事项:备份网站文件和数据库:在进行任何修改之前,务必备份网站的所有文件和数据库。您可以使用FTP工具下载网站文件,或者通过网站托管商提供的备份功......
  • K. GCD of Set
    贪心。猜测最优方案一定可以满足至多只有一个集合的大小不为1点击查看代码#include<bits/stdc++.h>usingnamespacestd;inta[1000005];intcnt[1000005];vector<int>c[1000005];vector<longlong>s[1000005];intmain(){ ios::sync_with_stdio(false); cin.tie(0......