记录用winscp连接到虚拟机的过程

首先,就是本机需要安装虚拟机(附上虚拟机下载地址:http://www.zdfans.com/html/5928.html

centOS 镜像下载:http://www.downcc.com/soft/27371.html

这里附上一篇虚拟机安装centOS的方法:https://blog.csdn.net/wtfmonking/article/details/14177805

注意:在安装过程需要输入管理密码和普通用户账号和密码  ,两者是不一样的。

安装完centOS后,需要在Linux里安装vsftpd,才能用winscp连接到虚拟机

安装最好切换到root权限,命令为: su

一、 检查服务器是否已经安装(在终端操作)

rpm  -qa  |grep   vsftpd

二、安装

如果输入上面的命令提示没有,那么进行安装

yum install  -y  vsftpd

三、检查服务是否正常启动(在centOS7以上版本命令可能会有点不一样)

       1.启动Vsftpd服务其命令为: service vsftpd start 或 /etc/init.d/vsftpd start

  2、停止Vsftpd服务的命令为:service vsftpd stop 或 /etc/init.d/vsftpd stop

  3、重新启动Vsftpd服务的命令为:service vsftpd restart 或 /etc/init.d/vsftpd restart

  4、检查Vsftpd服务的运行状态:service vsftpd status

得到上图结果即说明vsftpd安装成功。

将vsftpd添加到开机自启动

原来的:

chkconfig vsftpd on

centos7:

/bin/systemctl enable vsftpd.service

虚拟机需要在NAT模式下winscp才能连接到。

这里附上:虚拟机连接不上NAT模式的解决方法:https://www.jb51.net/article/136178.htm

在NAT模式下,你可以在终端查询ip地址:ifconfig -a

window的ip地址:ipconfig  (我连的是无线)

在虚拟机和本机,你可以互相ping下,看能否接通

在ping通的情况下,再检查下centOS相应的端口有没有开启

linux centOS开启80  22  3306端口

 ftp是21端口

1、设定(ps:iptables 后面的是 -I(i的大写))

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 21  -j ACCEPT

2、保存

[root@localhost ~]# /etc/rc.d/init.d/iptables save

3、重启防火墙

[root@localhost ~]# service iptables restart

4、查看

[root@localhost ~]# /etc/init.d/iptables status

使用ftp连接虚拟机,主机名即为虚拟机的ip地址,若用普通账户登录,会有权限不够的限制,用root登录如果会出现以下问题,我附上了相应的解决方案

winscp连接linux时提示连接失败OOPS:cannot change directory:/home/....什么的原因以及解决方案

附上解决方案:https://blog.csdn.net/df981011512/article/details/53293212

CentOS搭建ftp后,winSCP连接报错为“列出’/home/ftp’的目录项时出错”

附上解决方案:https://blog.csdn.net/ever_peng/article/details/80161942

FTP连接报错530 Permission denied解决方法

附上解决方案:https://blog.csdn.net/weiyuefei/article/details/51285765

发布了7 篇原创文章 · 获赞 6 · 访问量 710

猜你喜欢

转载自blog.csdn.net/SingleNobleTH/article/details/95966316