Ubuntu 配置 ftp 服务器
来源:互联网 发布:摄像头侵入软件 编辑:程序博客网 时间:2024/06/05 09:30
为了在机子上架设ftp服务器,我们需要安装ftp服务器软件。Linux下具有代表性的ftp服务器软件有Wu-FTP,ProFTP和Vsftp。
- Wu-FTP(Washington University FTP)由美国华盛顿大学开发。它的功能强大,配置较复杂。由于开发时间较早,应用十分广泛,也因此成为黑客们主要的攻击目标。
- ProFTP针对Wu-FTP的弱项而开发,在安全性方面进行了改进,并提供了一些Wu-FTP没有的功能,大大简化了架设和管理FTP服务器的工作。
- Vsftp在安全性,高性能及稳定性3个方面上有上佳的表现。它提供的主要功能包括虚拟IP设置,虚拟用户,standalone(可自行单独启动的daemon),inetd操作模式(由一支特殊的super daemon管理),强大的单用户设置能力以及带宽限流等。接下来我们主要讲解在ubuntu上如何架设vsftpd。
1、安装vsftpd
终端输入
sudo apt-get install vsftpd
2、配置 vsftpd
一个很好的 参考说明:
http://www.jb51.net/LINUXjishu/66983.html
http://www.blogjava.net/stonestyle/articles/369104.html
vsftpd的配置文件:
在ubuntu中,vsftpd的主要配置文件分布如下:
/etc/vsftpd.conf vsftpd服务器的配置文件
/usr/sbin/vsftpd vsftpd服务器的进程文件
/etc/pam.d/vsftpd vsftpd服务器的PAM接口配置文件
/var/ftp vsftpd服务器匿名用户的工作目录
3. 开启关闭 ftp 服务
sudo /etc/init.d/vsftpd restart // 重新启动 vsftpd 服务
sudo start vsftpd // 启动服务
sudo stop vsftpd // 关闭服务
sudo restart vsftpd // 重新启动服务
sudo killall -HUP vsftpd // 重启vsftpd进程
sounion@ubuntu:~$ netstat -tnl | grep :21tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
检查可发现端口21正在被监听4.匿名用户配置
配置匿名用户,使得
1 FTP服务器支持匿名用户(帐号:anonymous 密码:任意)登录
2 只要ftp用户(操作系统用户)在操作系统有读权限,就可以下载文件
3 匿名用户登录后进入/var/ftp/anonymous目录,可以下载该目录中的文件
4 可以上传文件到目录/var/ftp/anonymous/upload目录中,但不能下载或删除该目录中的文件
利用vim修改vsftpd.conf文件
anonymous_enable=YES
anon_world_readable_only=NO
anon_root=/var/ftp/anonymous
anon_upload_enable=YES
chown_uploads=YES
在/var/ftp 目录下新建目录anonymous,所有者为root
(否则会产生ftp server链接失败
Command: USER anonymous
Response: 331 Please specify the password
Command: PASS ******
Response: 500 OOPS:vsftpd:refusing to run with writable root inside chroot()
Error: Critical error
Error: Could not connect to server
)
在/var/ftp/anonymous目录下新建目录upload,所有者为ftp
sounion@ubuntu:/var/ftp$ ls -altotal 20drwxr-xr-x 5 root root 4096 Apr 20 22:35 .drwxr-xr-x 14 root root 4096 Apr 20 20:08 ..drwxr-xr-x 3 root ftp 4096 Apr 20 22:36 anonymoussounion@ubuntu:/var/ftp$ ls -al anonymous/total 12drwxr-xr-x 3 root ftp 4096 Apr 20 22:36 .drwxr-xr-x 5 root root 4096 Apr 20 22:35 ..drwxr-xr-x 2 ftp ftp 4096 Apr 20 22:36 upload
确保 write_enable 开关打开,否则 anonymous 仍然无法上传文件。
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
错误信息如下:
Response: 553 Could not create file.
Error: Critical file transfer error
设置好 write_enable=YES后重启 vsftpd, 现在可以上传文件值 /var/ftp/anonymous/upload 目录。
再对应设置好0755权限使得 /var/ftp/anonymous/download 目录仅支持下载权限。
(如果是chmod 744,仍然无法下载。会产生错误:
Response: 550 Failed to open file.
Error: Critical file transfer error.
)
sounion@ubuntu:/var/ftp/anonymous$ ls -al
total 16
drwxr-xr-x 4 root ftp 4096 Apr 20 23:00 .
drwxr-xr-x 5 root root 4096 Apr 20 22:35 ..
drwxr-xr-x 2 root root 4096 Apr 20 23:09 download
drwxrwxrwx 2 ftp ftp 4096 Apr 20 23:07 upload
5、本地用户登录
(缺省 vsftpd 仅支持匿名用户登录。/etc/vsftpd.conf 中设置
#
# Uncomment this to allow local users to log in.
local_enable=YES
listen_port=21
- ubuntu配置ftp服务器
- Ubuntu 配置 ftp 服务器
- Ubuntu配置ftp服务器
- ubuntu ftp 服务器配置
- ubuntu 配置FTP服务器
- ubuntu中ftp服务器配置
- ubuntu安装ftp服务器配置
- Ubuntu下配置FTP服务器
- ubuntu 16.0 ftp服务器配置
- ubuntu 安装配置FTP服务器
- ubuntu简单配置ftp服务器
- ubuntu下配置ftp服务器
- Ubuntu 下面FTP服务器配置
- Ubuntu下FTP服务器的配置
- Ubuntu下ftp服务器配置方法
- ubuntu安装ftp服务器(一般配置)
- Ubuntu下ftp服务器配置方法
- Ubuntu下FTP服务器的配置
- ZedGraph 自定义 X轴 Y轴 标注 画虚线
- 华为软件笔试题
- 3D数学--学习笔记(二):3D中绕坐标轴的旋转
- 瘦腿的三个黄金时间点
- 引用wcf时常见异常
- Ubuntu 配置 ftp 服务器
- Nosql Mongodb之旅(20)—MongoDB性能监控
- HTML5 7款华丽的HTML5/CSS3应用
- KMP算法的详解
- 【UI设计】扁平化设计之流行色值
- 实现嵌套链表
- Oracle数据库imp
- 【C++笔记】第三章 标准库类型.cc
- 设计网页按钮时的注意事项