检查是否已经安装ftp
没安装命令执行后什么也没有
[sfapp@cnsz22vl0329 ~]$ rpm -qa|grep vsftpd
安装后如下
[root@cnsz22vl0329:/root/tools/ftp]#rpm -qa|grep vsftpd
vsftpd-2.2.2-12.el6_5.1.x86_64
安装
[sfapp@cnsz22vl0329 ftp]$ su - root
[root@cnsz22vl0329:/root/tools/ftp]#yum install vsftpd -y
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
rhel6Server-basic | 4.1 kB 00:00
rhel6Server-epel | 4.3 kB 00:00
rhel6Server-epel/primary_db | 5.8 MB 00:00
rhel6Server-others | 2.9 kB 00:00
rhel6Server-others/primary_db | 52 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-12.el6_5.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================
Package Arch Version Repository Size
==============================================================================================================
Installing:
vsftpd x86_64 2.2.2-12.el6_5.1 rhel6Server-basic 151 k
Transaction Summary
==============================================================================================================
Install 1 Package(s)
Total download size: 151 k
Installed size: 331 k
Downloading Packages:
vsftpd-2.2.2-12.el6_5.1.x86_64.rpm | 151 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-12.el6_5.1.x86_64 1/1
Verifying : vsftpd-2.2.2-12.el6_5.1.x86_64 1/1
Installed:
vsftpd.x86_64 0:2.2.2-12.el6_5.1
Complete!
[root@cnsz22vl0329:/root/tools/ftp]#ls
[root@cnsz22vl0329:/root/tools/ftp]#rpm -qa|grep vsftpd
vsftpd-2.2.2-12.el6_5.1.x86_64
[root@cnsz22vl0329:/root/tools/ftp]#
2、启动服务
使用vsftpd软件,主要包括如下几个命令:
启动ftp命令#service vsftpd start
停止ftp命令#service vsftpd stop
重启ftp命令#service vsftpd restart
-
3、vsftpd的配置
ftp的配置文件主要有三个,位于/etc/vsftpd/目录下,分别是:
ftpusers 该文件用来指定那些用户不能访问ftp服务器。
user_list 该文件用来指示的默认账户在默认情况下也不能访问ftp
vsftpd.conf vsftpd的主配置文件
-
4、以匿名用户为例,我们去掉配置文件vsftpd.conf 里面以下
anon_upload_enable=YES
anon_mkdir_write_enable=YES
两项前面的#号,就可以完成匿名用户的配置,此时匿名用户既可以登录上传、下载文件。记得修改配置文件后需要重启服务。
5、非匿名账户的创建与使用
vsftpd服务与系统用户是相互关联的,例如我们创建一个名为test 的系统用户,那么此用户在默认配置的情况下就可以实现登录,如图
登录后在页面创建名为“aa”的文件夹,同样我们在服务器test用户 的home目录里也可以看到相同的文件。
[root@cnsz22vl0329:/etc/vsftpd]#useradd lixiaolong
[root@cnsz22vl0329:/etc/vsftpd]#passwd lixiaolong
Changing password for user lixiaolong.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: not enough character classes
Retype new password:
Sorry, passwords do not match.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: not enough character classes
Retype new password:
passwd: all authentication tokens updated successfully.
[root@cnsz22vl0329:/etc/vsftpd]#cd /home/
[root@cnsz22vl0329:/home]#ls
appdeploy lixiaolong logmonitor mwopr sfada sfapp sfarc sfdba sflog sfstorage
[root@cnsz22vl0329:/home]#cd lixiaolong/