1c7 / VideoList

:us: -> :cn: @糖醋陈皮 翻译的视频列表
https://weibo.com/2004104451
57 stars 11 forks source link

Ubuntu 14.04 配置 FTP #71

Open 1c7 opened 8 years ago

1c7 commented 8 years ago

1.1 安装 vsftpd (Very Secure FTP Daemon).

apt-get update
apt-get -y install vsftpd

-y 代表待会不用输入 Y 确认安装


1.2 配置

这里跳过,去看原文把


1.3 创建一个 FTP 用户

sudo adduser ftpuser
sudo chown root:root /home/ftpuser

chown 是改变文件或目录的拥有者 root:root 代表是 root 用户 root 组


建个目录用于保存上传的文件
sudo mkdir /home/ftpuser/files
sudo chown ftpuser:ftpuser /home/ftpuser/files
生成一个证书
sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 
-keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

https://www.openssl.org/docs/manmaster/apps/openssl.html 我反正没看懂参数都是啥意思= =


打开配置文件
sudo nano /etc/vsftpd.conf
在最后面增加
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH

保存并关闭

重启服务

sudo service vsftpd restart


看下哪些服务在监听哪些端口

sudo netstat -tulpn



Ubuntu 这边配置好了,现在我们用 Windows 上的 FTP 软件连接过去

我们这里用 FlashFXP, 你也可以用什么 FileZilla 之类的

image 要改的地方都标出来了。 第一次连接的时候会有一个证书提示之类的,确认并保存就好,下次就没有提示了。

这里的 IP 是我 Ubuntu 虚拟机的 IP image


测试上传文件

image image

image

image



重点总结

  1. 在 Linux 这边创建个用户好管理些
  2. 没法上传,修改,删除,新增的时候。注意下文件 / 文件夹的所有者和权限。



参考资料: https://www.digitalocean.com/community/tutorials/how-to-configure-vsftpd-to-use-ssl-tls-on-an-ubuntu-vps https://wiki.debian.org/vsftpd https://wiki.archlinux.org/index.php/Very_Secure_FTP_Daemon https://wiki.archlinux.org/index.php/Very_Secure_FTP_Daemon_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) (中文)

1c7 commented 8 years ago

https://help.ubuntu.com/community/SSH/TransferFiles