利用ftp实现物理机与虚拟机之间的上传下载功能

在物理及和虚拟主机上配置ftp,实现上传和下载的功能

1.在虚拟机中安装vsftpd软件

[root@q1 ~]# yum -y install vsftpd

2.查看配置文件目录 /etc/vsftpd

[root@q1 ~]# cd /etc/vsftpd/[root@q1 vsftpd]# lsftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh

3.开启ftp服务,并关闭防火墙和selinux

[root@q1 vsftpd]# systemctl start vsftpd[root@q1 vsftpd]# systemctl stop firewalld [root@q1 vsftpd]# setenforce 0

4.进入共享目录 /var/ftp创建测试文件

[root@q1 vsftpd]# ls /var/ftppub[root@q1 vsftpd]# echo "this is test" > /var/ftp/test.txt

5.创建测试用户,并设置密码

[root@q1 vsftpd]# useradd uftp [root@q1 vsftpd]# echo 1 | passwd --stdin uftp 更改用户 uftp 的密码 。passwd:所有的身份验证令牌已经成功更新。

6.进入物理机cmd命令框,使用ftp连接虚拟机

C:\Users\31836>ftp 192.168.1.21连接到 192.168.1.21。220 (vsFTPd 3.0.2)200 Always in UTF8 mode.用户(192.168.1.21:(none)): uftp331 Please specify the password.密码:

230 Login successful.ftp> ls200 PORT command successful. Consider using PASV.150 Here comes the directory listing.226 Directory send OK.

7.进入共享目录,查看测试文件

ftp> cd /var/ftp250 Directory successfully changed.ftp> ls200 PORT command successful. Consider using PASV.150 Here comes the directory listing.pubtest.txt226 Directory send OK.ftp: 收到 18 字节,用时 0.00秒 18000.00千字节/秒。

下载/上传test.txt文件

ftp> get test.txt200 PORT command successful. Consider using PASV.150 Opening BINARY mode data connection for test.txt (13 bytes).226 Transfer complete.ftp: 收到 13 字节,用时 0.00秒 13000.00千字节/秒。

上传

ftp> put test.txt200 PORT command successful. Consider using PASV.150 Ok to send data.226 Transfer complete.ftp: 发送 13 字节,用时 0.00秒 13000.00千字节/秒

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值