今天学习了Ubuntu上安装ftp的实例。

1.window上已经安装wamp(windows + apache + mysql + php)

2.window上已安装VMware Workstation

3.虚拟机上安装Ubuntu(Linux操作系统)

4.Ubuntu上安装lamp(Linux + apache + mysql + php)

这里Ubuntu作为服务器(Server),windows作为客户端(Client).

演示步骤如下:

第一步:安装vsftpd

打开"终端窗口",输入"sudo apt-get install vsftpd"-->回车-->安装完成。

root@wuheng-virtual-machine:/# sudo apt-get install vsftpd

第二步:判断vsftpd是否安装成功

打开"终端窗口",输入"sudo service vsftpd restart"重启vsftpd服务-->回车-->vsftpd处于运行状态,说明安装成功。

root@wuheng-virtual-machine:/# sudo service vsftpd restart
vsftpd stop/waiting
vsftpd start/running, process 5569
 
注意:这里“process 5569”,表示vsftpd处于运行状态。

第三步:新建"/home/uftp"目录作为用户主目录

打开"终端窗口",输入"sudo mkdir /home/uftp"-->回车-->输入"sudo ls /home"-->回车-->有一个uftp目录,目录新建成功。

root@wuheng-virtual-machine:/# sudo mkdir /home/uftp
root@wuheng-virtual-machine:/#
sudo ls /home

第四步:新建用户uftp并设置密码

打开"终端窗口",输入"sudo useradd -d /home/uftp -s /bin/bash uftp"-->回车-->用户新建成功-->

输入"sudo passwd uftp"设置uftp用户的密码-->回车-->输入两次密码-->回车-->密码设置成功

root@wuheng-virtual-machine:/# sudo useradd -d /home/uftp -s /bin/bash uftp
root@wuheng-virtual-machine:/#
sudo passwd uftp

注意:这里要输入2次相同的密码。

第五步:使用gedit修改配置文件/etc/vsftpd.conf

打开"终端窗口",输入"sudo gedit /etc/vsftpd.conf"-->回车-->打开了vsftpd.conf文件,向文件中添加"userlist_deny=NO

userlist_enable=YES userlist_file=/etc/allowed_users"和"seccomp_sandbox=NO"-->使文件中的"local_enable=YES"-->保存。

如:

在vsftpd.conf配置文件下面加入如下配置信息

userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/allowed_users
seccomp_sandbox=NO

添加后,保存。注意,可能会保存不成功。报错如:“Could not create a backup file while saving “/etc/vsftpd.conf”

我的解决办法,修改vsftpd.conf配置文件的权限。

-rwxrwxrwx  1 root root     5776 Mar  9 22:55 vsftpd.conf
修改完后,保存。该配置文件的权限应当恢复原状。

第六步:使用gedit新建/etc/allowed_users文件

打开"终端窗口",输入"sudo gedit /etc/allowed_users"-->回车-->输入uftp-->保存, 文件创建成功。

root@wuheng-virtual-machine:/# sudo gedit /etc/allowed_users
utfp

第七步:使用gedit查看/etc/ftpusers文件中的内容

打开"终端窗口",输入"sudo gedit /etc/ftpusers"-->回车-->打开这个文件后,看一看有没有uftp这个用户名,如果没有,就直接退出。

如果有就删除uftp,因为这个文件中记录的是不能访问FTP服务器的用户清单。

root@wuheng-virtual-machine:/# sudo gedit /etc/ftpusers
# /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5).

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
nobody

注意:上面标识红色的,表示这些用户都不能访问FTP服务器,这里没有:uftp用户名,可以直接关掉

第八步:登录FTP服务器

在windows上先安装FlashFXP

a.站点名称,可以自定义。

b.连接类型:ftp

c.地址,也就是服务器的ip地址,这里服务器的ip地址是:192.168.157.128

root@wuheng-virtual-machine:/# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:cd:21:c3  
          inet addr:192.168.157.128  Bcast:192.168.157.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fecd:21c3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2451 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2833 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:327202 (327.2 KB)  TX bytes:2936304 (2.9 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:230 errors:0 dropped:0 overruns:0 frame:0
          TX packets:230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:28208 (28.2 KB)  TX bytes:28208 (28.2 KB)

d.端口号:21

e.用户名:uftp     (就是我们之前建立的用户,如第三步,第四步)

f.密码:xxxxx  (就是我们之前设置的密码,如第四步)

第九步:连接ftp

表示连接成功了。

a.客户端

b.服务器

root@wuheng-virtual-machine:/var/www/html# ls -l
total 20
-rw-r--r-- 1 uftp uftp     0 Mar  9 19:40 a.txt
drwxrwxrwx 3 root root  4096 Mar  9 22:57 demo
-rwxrwxrwx 1 root root 11510 Mar  9 19:21 index.html
lrwxrwxrwx 1 root root    21 Mar  3 18:46 phpmyadmin -> /usr/share/phpmyadmin
-rw-r--r-- 1 root root   249 Mar  9 19:21 wh.tar.gz
root@wuheng-virtual-machine:/var/www/html#

第十步,可能出现的问题与解决方案

a.可能出现本地向ftp上传文件,出现上传不了的情况

解决方案:在vsftpd.conf配置文件中,添加:“write_enable=YES  local_umask=022”

write_enable=YES
local_umask=022

这2项表示:可以上传。以确保本地虚拟用户能有读写权限。

参考:http://jingyan.baidu.com/article/67508eb4d6c4fd9ccb1ce470.html

Ubuntu14.4下安装FTP的更多相关文章

  1. Ubuntu14.0下安装Zend Framework 2

    Ubuntu14.0下安装Zend Framework 2为了安装这个东西,忙活了快一天了,参考中文博客一直没有安装成功,有些博客的时间也是已经很早了,后来google看英文版的才安装成功,这里记录一 ...

  2. Ubuntu14.04下安装Hadoop2.5.1 (单机模式)

    本文地址:http://www.cnblogs.com/archimedes/p/hadoop-standalone-mode.html,转载请注明源地址. 欢迎关注我的个人博客:www.wuyudo ...

  3. 二、Ubuntu14.04下安装Hadoop2.4.0 (伪分布模式)

    在Ubuntu14.04下安装Hadoop2.4.0 (单机模式)基础上配置 一.配置core-site.xml /usr/local/hadoop/etc/hadoop/core-site.xml ...

  4. Ubuntu14.04下安装Flash Player

    Ubuntu14.04下安装Flash Player youhaidong@youhaidong:~$ sudo apt-get install flashplugin-nonfree [sudo] ...

  5. Ubuntu14.04下 安装p4c

    参考: Github p4c README Ubuntu14.04下 安装p4c 这里提供一个直接安装p4c的脚本:install_p4c.sh. 1.git clone下来p4c: $ git cl ...

  6. Ubuntu14.04下安装Libsvm,并使用Libsvm

    (1)Ubuntu14.04下安装Libsvm 转载:https://blog.csdn.net/katrinawj/article/details/78915874 一.下载: 网址:http:// ...

  7. ubuntu14.04下安装ffmpeg

    ubuntu14.04下安装ffmpeg 一.安装各种依赖包 1.yasm(libx264需要依赖yasm) sudo apt-get install yasm 2.libx264 sudo apt- ...

  8. CentOS7.0下安装FTP服务的方法

    http://www.jb51.net/article/106604.htm   本篇文章主要介绍了CentOS7.0下安装FTP服务的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考.一起跟 ...

  9. ubuntu14.04下安装cudnn5.1.3,opencv3.0,编译caffe及配置matlab和python接口过程记录

    已有条件: ubuntu14.04+cuda7.5+anaconda2(即python2.7)+matlabR2014a 上述已经装好了,开始搭建caffe环境. 1. 装cudnn5.1.3,参照: ...

随机推荐

  1. AFNetworking 文件上传Data,File图片,文件等上传

    一:AFNetworking的文件上传: 主要几个以下类似 - (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name e ...

  2. 算法笔记_093:蓝桥杯练习 Problem S4: Interesting Numbers 加强版(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 Problem Description We call a number interesting, if and only if: 1. Its d ...

  3. 算法笔记_070:BellmanFord算法简单介绍(Java)

    目录 1 问题描述 2 解决方案 2.1 具体编码   1 问题描述 何为BellmanFord算法? BellmanFord算法功能:给定一个加权连通图,选取一个顶点,称为起点,求取起点到其它所有顶 ...

  4. mysql,给每一条数据的某一个字段生成不同的随机数

    UPDATE t_article ta-- 利用LEFT JOIN的方式进行关联修改 LEFT JOIN(-- 先通过查询的方式给每一条数据生成对应的10-500之间随机数 SELECT articl ...

  5. hibernate查询排序

    hibernate提供了两种排序方式:1:数据库排序,也就是说通过SQL语句在数据库内部就进行完了排序.2.内存排序,也就是说在数据库中把数据加载到内存中后在进行排序.推荐使用第一种排序方式,因为在数 ...

  6. hibernate 一对多双向

    package com.bjsxt.hibernate; import java.util.HashSet; import java.util.Set; import javax.persistenc ...

  7. Firefly 3288又一次制作android和lubuntu双系统固件

    又一次制作android和lubuntu双系统固件 因为本人改动了lubuntu的驱动和设备树信息,为了方便烧写系统,所以又一次制作了双系统的固件. Firefly wiki教程里有android固件 ...

  8. java类的初始化和构造函数

    本人小白一枚,看java类的初始化的时候好晕的说,我觉着书上尽管说的对.但总认为有些信息没说出来,没说清楚,看了好多文章博客的,如今有些感悟,来小写下总结,也算是为以后再次复习种个好果子. 先摘一下书 ...

  9. pandas drop_duplicates

    函数 : DataFrame.drop_duplicates(subset=None, keep='first', inplace=False) 参数:这个drop_duplicate方法是对Data ...

  10. PHP的session存储对PHP运行环境的影响

    转于:http://hmw.iteye.com/blog/1704020 这个问题的引入是由于公司一个项目里需要使用单点登录的功能,为了方便起见,就使用redis来替换php默认的文件存储sessio ...