Create & use FTP service on Ubuntu(在Ubuntu上搭建并使用FTP服务)

  • Check if the FTP service has been installed.(检查是否已安装)

 1 Vsftpd --version 

  • If it has not install,Press the command to install it:(如果没有安装,按下面命令安装)

 1 sudo apt-get install vsftpd 

  • After installed , We need to configure it .(安装完后,我们需要配置)

The FTP main configuration file is “vsftpd.conf”,Path:/etc/vsftpd.conf

  • The common parameter description for “vsftpd.conf”(常用的参数)
 1 anonymous_enable=NO                  拒绝匿名登录
 2 write_enable=YES                          设置可以上传文件,这个设置看需要个人需要
 3 xferlog_enable=YES                        开启日志记录
 4 xferlog_file=/var/log/vsftpd.log                设置日志文件路径
 5 xferlog_std_format=YES                          设置日志格式为标准输出
 6 connect_from_port_20=YES                     绑定20端口
 7 ftpd_banner=Welcome to FTP service.       欢迎语句,在使用shell时可以看到
 8 chroot_local_user=YES
 9 chroot_list_enable=YES
10 chroot_list_file=/etc/vsftpd.chroot_list       需要自己手动创建
11 pam_service_name=ftp                            原配置中为vsftpd,ubuntu用户需要更改成ftp
  • Uncomment(取消注释)
1 chroot_local_user=NO                           #不允许本地用户登录
2 #chroot_list_enable=YES
3 # (default follows)
4 chroot_list_file=/etc/vsftpd.chroot_list    #只有这个list中的用户可以登录


  • Add the follows at the end of text:(在文本末尾添加一下内容:)
1 utf8_filesystem=YES
2 anon_root=/home/ftp
3 no_anon_password=YES
4 anon_upload_enable=YES
5 anon_mkdir_write_enable=YES

 

  • Create FTP user(创建用户)
1 mkdir /home/ftp/                                              创建ftp目录
2 useradd -d /home/ftp -s /bin/bash ftpuser           创建用户ftpuser
3 passwd ftpuser                                                  设置用户密码
4 usermod –s /sbin/nologin ftpuser                        将ftpuser用户禁锢

 

  • Change folder permissions(更改文件夹权限)
  • NOTICE : You need create “/etc/vsftpd.chroot_list” manually , and put “ftpuser” in it.
  • (注意:你需要手动创建“/etc/vsftpd.chroot_list”,并且把“ftpuser”放里面
原文地址:https://www.cnblogs.com/Smbands/p/10148848.html