1.首先要查看你的服务器上是否安装有vsftpd软件
命令是这玩意:rpm -qa | grep vsftpd
没出现任何东西,就是没有安装
2.接下来直接用yum安装,命令是这玩意:yum -y install vsftpd
3.由于是用yum安装的所以它的安装目录默认在/etc/vsftpd/
那么就cd /etc/vsftpd/
vi vsftpd.conf
anonymous_enable=NO
4默认是YES,修改成NO,表示不允许匿名用户登录
service vsftpd restart
5..创建ftp用户,比如ftp_test。命令:useradd -s /sbin/nologin -d /home/ftp_test ftp_test
给用户赋密码:passwd ftp_test
6..在另外一台机器上安装ftp客户端,为了省事也是直接用yum进行安装
然后
rpm -Uvh http://mirror.centos.org/centos/6/os/x86_64/Packages/ftp-0.17-54.el6.x86_64.rpm
7. 接下来执行这几个操作
setsebool -P ftp_home_dir 1
getsebool -a |grep ftp_home
setsebool -P ftpd_disable_trans 1
service vsftpd restart
8.注意,主机的启动,客户端也得启动。然后在主机进入/home/ftp_test 赋权给chmod 777 ftp_test ftp_test。
这样才有权限。
9.到客户端,ftp 192.168.186.138
Connected to 192.168.186.138 (192.168.186.138).
220 (vsFTPd 2.2.2)
Name (192.168.186.138:root): ftp_test
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
10,记得在主机 到/home/ftp_test里面建立 vi test.txt,测试。然后到客户端。ftp> pwd
257 "/home/ftp_test"
ftp> ls
227 Entering Passive Mode (192,168,186,138,236,16).
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 4 May 21 00:41 test.txt
-rw-r--r-- 1 500 500 969 May 21 00:45 yum.conf
226 Directory send OK.
ftp> get test.txt
local: test.txt remote: test.txt
227 Entering Passive Mode (192,168,186,138,77,210).
150 Opening BINARY mode data connection for test.txt (4 bytes).
226 Transfer complete.
4 bytes received in 7.2e-05 secs (55.56 Kbytes/sec)
11.记得直接get test.txt ,加路径不行,不知道为什么。
本文详细介绍如何在服务器上安装和配置VSFTPD服务,包括禁用匿名登录、创建FTP用户、安装FTP客户端及测试连接的过程。
393

被折叠的 条评论
为什么被折叠?



