Forward from: https://linuxconfig.org/how-to-setup-vsftpd-ftp-file-server-on-redhat-7-linux

How to setup vsftpd FTP file Server on Redhat 7 Linux

 

In this short config we will install FTP file Server on RHEL7 Linux using vsftpd. We will stick to the default vsftpd configuration which enables user accounts on our existing RHEL7 Linux system to login via FTP from a remote location, list and transfer files. Let's begin by the installation:

To install FTP server on Redhat 7 Linux we can use either tftp-server or vsftpd daemon. In this guide we use vsftpd:

[root@rhel7 ~]# yum install vsftpd

Next, we can start the vsftpd service by using a service command:

[root@rhel7 ~]# service vsftpd start
Redirecting to /bin/systemctl start vsftpd.service

To make the FTP service startup persistent after system reboot use:

[root@rhel7 ~]# systemctl enable vsftpd
ln -s '/usr/lib/systemd/system/vsftpd.service' '/etc/systemd/system/multi-user.target.wants/vsftpd.service'

Check and see whether port 21 is open. Do not worry if you do not see IPv4 of this port open as its IPv6 bind.

[root@rhel7 ~]# netstat -tanp | grep LISTEN

We also need to open firewall port otherwise we will see a following error message when we try to connect:

ftp: connect: No route to host
ftp>

To open a port 21 on Redhat 7 linux use the following commands. The port we remain open to public even after system restart:

[root@rhel7 ~]# firewall-cmd --zone=public --add-port=21/tcp --permanent
success
[root@rhel7 ~]# firewall-cmd --reload
success

At this point we should be able to connect from a remote host where the IP address of our FTP service is 10.1.1.110:

$ ftp 10.1.1.110
Connected to 10.1.1.110 (10.1.1.110).
220 (vsFTPd 3.0.2)
Name (10.1.1.110:lrendek): rhel7
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

The next configuration we need to perform is to enable iptables module ip_conntrack_ftp otherwise we will see a following error message query our FTP server after successful login:

ftp> ls
227 Entering Passive Mode (10,1,1,110,166,190).
ftp: connect: No route to host
ftp>

As a temporary solution we use modprobe to load the ip_conntrack_ftp module:

[root@rhel7 ~]# modprobe ip_conntrack_ftp

See this page for a more permanent solution on how to load ip_conntrack_ftp module after reboot.

The last configuration we need to perform is to enable selinux FTP context for user directories currently on the system otherwise we will not be able to read/write or transfer any files between FTP server and FTP client:

230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put ftp-test.txt
local: ftp-test.txt remote: ftp-test.txt
227 Entering Passive Mode (10,1,1,110,125,139).
553 Could not create file.

To enable selinux FTP home directory context to allow read and write commands. For this we use setsebool command:

[root@rhel7 ~]# setsebool -P ftp_home_dir=1

The above will set selinux FTP home directory context permanently -P after reboot.

ftp> put ftp-test.txt
local: ftp-test.txt remote: ftp-test.txt
227 Entering Passive Mode (10,1,1,110,174,219).
150 Ok to send data.
226 Transfer complete.

Now you have your FTP server setup. For more configuration options see the main vsftpd FTP server configuration file/etc/vsftpd/vsftpd.conf. When making a changes to the configuration file make sure to apply them by restarting FTP service:

[root@rhel7 ~]# service vsftpd restart
Redirecting to /bin/systemctl restart vsftpd.service

How to setup vsftpd FTP file Server on Redhat 7 Linux的更多相关文章

  1. Setup VSFTPD Server with Virtual Users On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3

    We have already shown you How to Setup VSFTPD Server on CentOS 6.5/6.4 in our previous article. In t ...

  2. FTP:500 OOPS: failed to open vsftpd log file:/var/log/vsftpd.log

    如下:从10.12.8.165 FTP 到 10.1.3.34,报failed to open vsftpd log[a4_csbdc@localhost ~]$ ftp  10.1.3.34Conn ...

  3. vsftp FTP服务器 server settings , and add different users

    建议阅读知识:http://linux.vbird.org/linux_basic/0210filepermission.php  这是关于档案权限,用户,组等的问题.介绍的很有意思. 1. Inst ...

  4. CentOS7安装及配置vsftpd (FTP服务器)

    CentOS7安装及配置vsftpd (FTP服务器) 1.安装vsftpd 1 yum -y install vsftpd 2.设置开机启动 1 systemctl enable vsftpd 3. ...

  5. Linux CentOS 6.5 下 vsftpd ftp服务器搭建

    Linux CentOS 6.5 下 vsftpd ftp服务器搭建 by:授客 QQ:1033553122   操作系统环境:CentOS 6.5-x86_64 下载地址:http://www.ce ...

  6. How to Setup a Private Proxy Server on EC2 in Under 10 Minutes

    How to Setup a Private Proxy Server on EC2 in Under 10 Minutes I’ve been slacking a bit with regular ...

  7. FTP - File Transfer Protocol

    FTP - File Transfer Protocol FTP 实际上使用了两个 TCP 链接. 一个作为控制信道用, 主要传输一些指令和响应, 比如 ACK 或 错误码. 另一个链接是数据信道, ...

  8. java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file Server/Request

    Linux服务器上,将本地编译好的文件上传后,Tomcat启动时报错: Exception in thread "Thread-2" java.lang.ClassFormatEr ...

  9. centos 5 yum安装与配置vsFTPd FTP服务器

    vsftpd作为FTP服务器,在Linux系统中是非常常用的.下面我们介绍如何在centos系统上安装vsftp. 什么是vsftpd vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序 ...

随机推荐

  1. YourSQLDba将数据库置于紧急模式的原因浅析

    从SQL SERVER 2000 上迁移了一个数据库到SQL SERVER 2008 R2上,暂且用DataBaseName代替迁移的真实的数据库名(后面的资料也会将数据库真实的名字用DataBase ...

  2. 《java JDK7 学习笔记》之接口与多态

    1.对于"定义行为"也就是接口,可以使用interface关键字定义,接口中的方法不能操作,直接标示为abstract,而且一定是public修饰的. 类要操作接口,必须使用imp ...

  3. Oracle索引梳理系列(八)- 索引扫描类型及分析(高效索引必备知识)

    版权声明:本文发布于http://www.cnblogs.com/yumiko/,版权由Yumiko_sunny所有,欢迎转载.转载时,请在文章明显位置注明原文链接.若在未经作者同意的情况下,将本文内 ...

  4. ORA-00911: invalid character --- 字符集的问题

    网上搜了一遍, 大多数是因为分号( ; ) 的问题.  而我的sql文件是没有分号的, 最后发现是sql文件编码和服务器字符集的差异造成 sql文件怎么都看不出问题,直到在UltraEdit里切换到1 ...

  5. Oracle创建表空间和用户

    用户名为:C##NEWO ============================================================================= /*分为四步 */ ...

  6. spring 4.x下让http请求返回json串

    当前很多应用已经开始将响应返回为json串,所以基于springframework框架开发的服务端程序,让响应返回json字符串成为了一种常用手段. 这里介绍一下如何在spring-MVC框架下方便快 ...

  7. saltstack简单部署和实践

    #Elaine:master;Dylan:minion#利用salt给minion安装包[root@elaine states]# vim /etc/salt/master default_inclu ...

  8. Redmine 插件安装

    将对应的插件都复制进redmine的plugins 安装对应所需要的GEMS bundle install --without development test rmagick 执行插件合并 bund ...

  9. WIN7下django1.8下载安装

    前言:公司电脑上django是在pycharm上下载自动安装的,家里电脑没安pycharm,所以自己手动安装. django下载地址:https://www.djangoproject.com/dow ...

  10. 【CSS】过渡、动画和变换

    1. 使用过渡 过渡效果一般是由浏览器直接改变元素的CSS属性实现的.例如,如果使用:hover选择器,一旦用户将鼠标悬停在元素之上,浏览器就会应用跟选择器关联的属性. <!DOCTYPE ht ...