您的位置:首页 > 编程语言 > PHP开发

使用vsftpd搭建ftp服务(下)

2018-01-09 15:32 573 查看

测试

在Windows上使用FTP服务进行测试,需要安装客户端软件filezilla;

在Linux上使用FTP服务进行测试,需要安装lftp工具 # yum install -y lftp;

[root@dl-001 vsftpd_user_conf]# lftp test1@127.0.0.1

口令:

lftp test1@127.0.0.1:~> ls

-rw-r--r--    1 1003     1004            0 Jan 03 01:56 dl.txt

lftp test1@127.0.0.1:/> ?    //查看可以使用的命令

!<shell-command>                     (commands)

alias [<name> [<value>]]             attach [PID]

bookmark [SUBCMD]                    cache [SUBCMD]

cat [-b] <files>                     cd <rdir>

chmod [OPTS] mode file...            close [-a]

[re]cls [opts] [path/][pattern]      debug [<level>|off] [-o <file>]

du [options] <dirs>                  exit [<code>|bg]

get [OPTS] <rfile> [-o <lfile>]      glob [OPTS] <cmd> <args>             help [<cmd>]

history -w file|-r file|-c|-l [cnt]  jobs [-v] [<job_no...>]

kill all|<job_no>                    lcd <ldir>

lftp [OPTS] <site>                   ln [-s] <file1> <file2>              ls [<args>]

mget [OPTS] <files>                  mirror [OPTS] [remote [local]]

mkdir [-p] <dirs>                    module name [args]                   more <files>

mput [OPTS] <files>                  mrm <files>

mv <file1> <file2>                   [re]nlist [<args>]

open [OPTS] <site>                   pget [OPTS] <rfile> [-o <lfile>]

put [OPTS] <lfile> [-o <rfile>]      pwd [-p]

queue [OPTS] [<cmd>]                 quote <cmd>

repeat [OPTS] [delay] [command]      rm [-r] [-f] <files>

rmdir [-f] <dirs>                    scache [<session_no>]

set [OPT] [<var> [<val>]]            site <site-cmd>                      source <file>

torrent [-O <dir>] <file|URL>...     user <user|URL> [<pass>]

wait [<jobno>]                       zcat <files>                         zmore <files>


方法1 使用xshell实现FTP的功能

新建会话,注意协议为SFTP



输入用户名



输入密码



登录成功

sftp:/root> ls    //使用SFTP协议登录成功

dr-xr-x---   10 root     root         4096 Jan  3 10:53 .

dr-xr-xr-x   20 root     root          256 Dec 14 22:33 ..

-rw-r--r--    1 root     root           18 Dec 29  2013 .bash_logout

-rw-r--r--    1 root     root          176 Dec 29  2013 .bash_profile

-rw-r--r--    1 root     root          176 Dec 29  2013 .bashrc

-rw-r--r--    1 root     root          100 Dec 29  2013 .cshrc

-rw-r--r--    1 root     root          129 Dec 29  2013 .tcshrc

-rw-------    1 root     root         5570 Oct 23 10:52 anaconda-ks.cfg

drwx------    2 root     root           48 Dec  6 19:07 .ssh

-rw-------    1 root     root        25194 Jan  3 01:12 .bash_history

-rw-r--r--    1 root     root            0 Oct 24 09:10 2.txt

-rw-------    1 root     root           55 Oct 24 09:51 .lesshst

drwxr-sr-x    2 user1    root           62 Dec  6 20:54 dir

drwxr-xr-x    2 root     root           30 Oct 26 22:55 222

drwxr-xr-x    2 root     root           21 Oct 26 23:20 dd

-rwx------    2 root     root           50 Oct 27 14:08 1.txt

-rwx------    2 root     root           50 Oct 27 14:08 1_heard.txt

lrwxrwxrwx    1 root     root            5 Oct 27 08:59 1_sorft.txt

drwxr-sr-x    2 user1    root           32 Oct 26 23:18 root@192.168.111.127

-rw-r--r--    1 root     root          395 Dec 17 22:30 1q

drwxr-----    3 root     root           19 Dec 18 20:17 .pki

-rw-------    1 root     root         2446 Dec 31 22:07 .mysql_history

-rw-r--r--    1 root     root           16 Dec 28 15:17 exit

drwxr-xr-x    3 root     root           19 Jan  3 10:20 .local

drwxr-xr-x    3 root     root           18 Jan  3 10:20 .config

-rw-------    1 root     root         7819 Jan  3 10:53 .viminfo


设定sftp工具下载的文件存放位置





设置完本地路径之后

在Linux中

sftp:/root> get 1.txt

Fetching /root/1.txt to 1.txt

sftp: received 50 ؖ½ؠin 0.05 seconds


在本地即可查看到传输的文件。

方法2使用xftp

在xshell中退出当前会话的状态下使用组合键:Ctrl+Alt+f 下载xftp插件,出现如下所示内容



说明:单击下载,根据提示安装xftp插件

单击跳转到此页面



说明已经发送到邮箱了,到邮箱查看下载地址



在你的邮箱里,点击此页面



点击此处下载



说明:下载完之后直接安装;在dl-02-sftp会话登录的状态下,Ctrl+Alt+f 启动Xftp

启动Xftp连接状态界面如下:



说明:左边为桌面,右边为虚拟机的/root目录

停掉21端口

[root@dl-001 ~]# systemctl stop vsftpd


说明:此时就可以传输文件了!!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ftp