Setup FTP Server on CentOS 7

Install vsftpd

vsftpd (Very Secure File Transport Protocol Daemon) is a secure, fast FTP server for Unix/Linux systems.

# install vsftp
yum install vsftpd -y #edit config file and
## disable anonymous login : change YES to NO
## uncomment ascii_upload_enable=YES and ascii_download_enable=YES
## Uncomment - Enter your Welcome message - This is optional ##
# ftpd_banner=Welcome to UNIXMEN FTP service. vim /etc/vsftpd/vsftpd.conf ## Add at the end of this  file ##
use_localtime=YES
#change to NO for listen_ipv6
listen_ipv6=NO
#change to YES for listen
listen=YES

#Following part is very important!!!

pasv_enable=YES
pasv_min_port=5000
pasv_max_port=6000
pasv_address=xxx.xxx.xxx.xxx  #public IP goes here

#optional
listen_port=2121
#Enable and start the vsftpd service: systemctl enable vsftpd systemctl start vsftpd

Add new User and set password

By default, root user is not allowed to login to ftp server for security purpose. So, let us create a normal testing user called “sk” with password “centos”.

useradd sk
passwd sk

> ftp 192.168.1.101

Errors and solutions:

1. vsftpd 425 Security: Bad IP connecting

主要是需要在/etc/vsftpd/vsftpd.conf文件中添加如下一行: pasv_promiscuous=YES

然后重启: systemctl restart vsftpd 解决问题

2、ftp中使用get后,文件位于本地哪里: 命令: lcd   或者指定目录 lcd /home/myfolder/testfolder

3、报“use PORT or PASV first.”, 需要使用命令:  quote pasv 或者quote port来切换。

4、关于zip/unzip,请访问 http://www.cnblogs.com/swlin/p/PHP.html

Set folder of ftp for user

Simple way:

https://unix.stackexchange.com/questions/94603/limit-ftp-access-only-to-the-var-www-with-vsftpd

Method 1: change user home default directory

Make sure following line exists:

chroot_local_user=YES

Set user HOME Directory to /var/www/ , if you want to change for existing user then you can use:

usermod --home /var/www/ username

then set required permission on /var/www/

Method 2: Use user_sub_tokenIf you don't want to change user's Home directory then you can use:

chroot_local_user=YES
local_root=/ftphome/$USER
user_sub_token=$USER

About user_sub_token

Automatically generate a home directory for each virtual user, based on a template. For example, if the home directory of the real user specified via guest_username is /ftphome/$USER, and user_sub_token is set to $USER, then when virtual user test logs in, he will end up (usually chroot()'ed) in the directory /ftphome/test. This option also takes affect if local_root contains user_sub_token.

Advanced way

http://askubuntu.com/questions/575523/how-to-setup-virtual-users-for-vsftpd-with-access-to-a-specific-sub-directory  (TO BE READ)

https://superuser.com/questions/269882/can-i-upload-an-entire-folder-using-ftp (TO BE READ)

How to remove systemd services

My recipe for service obliteration (be careful with the rm statements!)

systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] symlinks that might be related
systemctl daemon-reload
systemctl reset-failed

  

Reference

https://www.unixmen.com/install-configure-ftp-server-centos-7/

http://www.cnblogs.com/hhuai/archive/2011/02/12/1952647.html

FTP Commands:https://www.cs.colostate.edu/helpdocs/ftp.html

FTP Config: http://vsftpd.beasts.org/vsftpd_conf.html

setup FTP server on CentOS 7的更多相关文章

  1. Setup FTP Server On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3

    setsebool allow_ftpd_full_access onsetsebool -P ftp_home_dir on vsftpd (Very Secure File Transport P ...

  2. Setup FTP server on Ubuntu 14.04

    Setup FTP server on Ubuntu 14.04 Step 1 » Update repositories .krizna@leela:~$ sudo apt-get updateSt ...

  3. Setup Git Server in CentOS 6.3

    0. Environment: Server machine: CentOS 6.3 x86 Client machine: Windows 10 Pro x86_64 1. Install ssh ...

  4. Ubuntu setup ftp server.

    http://www.cnblogs.com/bcsflilong/p/4200139.html Steps 1. Install vsftpd sudo apt-get install vsftpd ...

  5. 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 ...

  6. centos 安装FTP server详情(转)

    centos 安装FTP server详情 分类: linux 2013-12-27 16:45 227人阅读 评论(0) 收藏 举报 我们这里以安装vsftpd 服务器端为例子: 1.进入到cent ...

  7. Centos下ftp协议连接远程ftp server主机

    环境说明 [root@Check3 ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@Check3 ~]# uname -a L ...

  8. Setup and Configure the vsftpd server in CentOS 7 operation system

    ############################################################################## 1. close the firewall ...

  9. How to set up an FTP server on Ubuntu 14.04

    How to set up an FTP server on Ubuntu 14.04 Setting up a fully-functional and highly secure FTP serv ...

随机推荐

  1. 在SOUI中使用线性布局

    SOUI 2.5.1.1开始支持线性布局(LinearLayout). 要在SOUI布局中使用线性布局, 需要在布局容器窗口里指定布局类型为vbox | hbox, (vbox为垂直线性布局, hbo ...

  2. (三)ajax请求不同源之cors跨域

    一.基本原理 CORS是一个W3C标准,全称是"跨域资源共享"(Cross-origin resource sharing)它允许浏览器向跨源服务器,发出 XMLHttpReque ...

  3. hwy题目选讲

    \[ f(n) = n/5 + f(n/5)\\ g(n) = (n\mod10)! * g(n/5)\mod 5\\ ans = f(n)*inv(2^g(n))\\ \]

  4. 获取远程IP、字符串解析

    public class StringUtil { private static final Pattern IPV4_PATTERN = Pattern.compile( "^(25[0- ...

  5. Everything at Once

    Everything at Once As sly as a fox as strong as an ox ♥ sly 英 [slaɪ] 美 [slaɪ] adj. 狡猾的:淘气的:诡密的 比较级 s ...

  6. css 制作圆角、圆形图形布局

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. jmeter实例介绍

    JMeter基础之一 一个简单的性能测试  测试需求: 1)测试目标网站是fnng.cnblogs.com 和 tt-topia.rhcloud.com 2)测试目的是该网站在负载达到20 QPS 时 ...

  8. IOS中多线程的总结

    首先要知道线程和进程的区别.一个系统上运行的每一个应用程序都是一个线程.而进程中要执行的任务都是在线程上来实现的,所以说线程是进程的最小执行单元. 进程最少要有一个线程.多线程,顾名思义就是多条线程. ...

  9. js一些代码

    1判断金额正则 var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; var money ...

  10. flask之wtforms

    本篇导航: wtforms组件的使用 自定义From组件 一.wtforms组件的使用 1.flask中的wtforms WTForms是一个支持多个web框架的form组件,主要用于对用户请求数据进 ...