如何在ubuntu12.04 LTS中安装和配置安全的FTP服务器

时间:2019-08-20 17:58:15  来源:igfitidea点击:

下载安装vsftpd包

tux@ubuntu:~$ sudo su -
  [sudo] password for tux:
  root@ubuntu:~#
  root@ubuntu:~# cd /root/
  root@ubuntu:~# wget http://security.ubuntu.com/ubuntu/pool/main/v/vsftpd/vsftpd_3.0.2-1ubuntu2_i386.deb
  –2013-05-20 09:36:20– http://security.ubuntu.com/ubuntu/pool/main/v/vsftpd/vsftpd_3.0.2-1ubuntu2_i386.deb
  Resolving security.ubuntu.com (security.ubuntu.com)… 91.189.92.190
  , 91.189.92.201, 91.189.92.202, …
  Connecting to security.ubuntu.com (security.ubuntu.com)|91.189.92.190|:80… connected.
  HTTP request sent, awaiting response… 200 OK
  Length: 114714 (112K) [application/x-debian-package]
  Saving to: `vsftpd_3.0.2-1ubuntu2_i386.deb’

  100%[=========================================================================================>] 114,714 219K/s in 0.5s

  2013-05-20 09:36:21 (219 KB/s) – `vsftpd_3.0.2-1ubuntu2_i386.deb’ saved [114714/114714]

  root@ubuntu:~#
  root@ubuntu:~#
  root@ubuntu:~# dpkg -i vsftpd_3.0.2-1ubuntu2_i386.deb

  Install the dependency of vsftpd

    root@ubuntu:~# apt-get install libcap2

备份vsftpd.conf文件并修改下面的参数,重新启动vsftpd服务。

# cp -p /etc/vsftpd.conf.dpkg-new /etc/vsftpd.conf
# cp -p /etc/vsftpd.conf /etc/vsftpd.conf.orig
# vi /etc/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES

# service vsftpd restart

/etc/vsftpd.conf文件参考:

root@ubuntu:~# egrep -v '^#|^$' /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
root@ubuntu:~#

现在使用命令行或者使用FTP客户端(filezilla)登录到FTP服务器。

如果是浏览器,输入 ftp://ftp服务器的IP地址进行登录。